Browse Source

[FIX] fix undeclared variable domain is a special case

pull/4/head
houssine 6 years ago
parent
commit
90969b1fef
  1. 9
      easy_my_coop/models/coop.py

9
easy_my_coop/models/coop.py

@ -254,8 +254,11 @@ class subscription_request(models.Model):
required=True, required=True,
readonly=True, readonly=True,
states={'draft': [('readonly', False)]}, states={'draft': [('readonly', False)]},
default=lambda self: datetime.strftime(datetime.now(), '%Y-%m-%d'))
company_id = fields.Many2one('res.company', string='Company', required=True,
default=lambda self: datetime.strftime(datetime.now(),
'%Y-%m-%d'))
company_id = fields.Many2one('res.company',
string='Company',
required=True,
change_default=True, change_default=True,
readonly=True, readonly=True,
default=lambda self: self.env['res.company']._company_default_get()) default=lambda self: self.env['res.company']._company_default_get())
@ -486,6 +489,7 @@ class subscription_request(models.Model):
partner = self.partner_id partner = self.partner_id
else: else:
partner = None partner = None
domain = []
if self.already_cooperator: if self.already_cooperator:
raise UserError(_('The checkbox already cooperator is' raise UserError(_('The checkbox already cooperator is'
' checked please select a cooperator.')) ' checked please select a cooperator.'))
@ -494,6 +498,7 @@ class subscription_request(models.Model):
elif not self.is_company and self.no_registre: elif not self.is_company and self.no_registre:
domain = [('national_register_number', '=', self.no_registre)] domain = [('national_register_number', '=', self.no_registre)]
if domain:
partner = partner_obj.search(domain) partner = partner_obj.search(domain)
if not partner: if not partner:

Loading…
Cancel
Save