Browse Source

[IMP] Added validator to 'country' field

pull/2/head
jmf 9 years ago
parent
commit
6121fe1f29
  1. 6
      beesdoo_base/models/partner.py

6
beesdoo_base/models/partner.py

@ -25,6 +25,12 @@ class Partner(models.Model):
def _on_change_name(self): def _on_change_name(self):
self.name = concat_names(self.first_name, self.last_name) self.name = concat_names(self.first_name, self.last_name)
@api.one
@api.constrains('country_id')
def _check_country(self):
if len(self.country_id) == 0:
raise ValidationError(_('Country is mandatory'))
@api.one @api.one
@api.depends('parent_eater_id', 'parent_eater_id.barcode', 'eater', 'member_card_ids') @api.depends('parent_eater_id', 'parent_eater_id.barcode', 'eater', 'member_card_ids')
def _get_bar_code(self): def _get_bar_code(self):

Loading…
Cancel
Save