mirror of
https://github.com/bringout/oca-ocb-l10n_me-africa.git
synced 2026-04-28 02:22:08 +02:00
19.0 vanilla
This commit is contained in:
parent
c5006a6999
commit
80293571e7
420 changed files with 21812 additions and 44297 deletions
17
odoo-bringout-oca-ocb-l10n_ma/l10n_ma/models/res_partner.py
Normal file
17
odoo-bringout-oca-ocb-l10n_ma/l10n_ma/models/res_partner.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from odoo import api, models, _
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
@api.constrains('company_registry', 'country_id')
|
||||
def _check_company_registry_ma(self):
|
||||
for record in self:
|
||||
if record.country_code == 'MA' and record.company_registry and (len(record.company_registry) != 15 or not record.company_registry.isdigit()):
|
||||
raise ValidationError(_("ICE number should have exactly 15 digits."))
|
||||
|
||||
def _get_company_registry_labels(self):
|
||||
labels = super()._get_company_registry_labels()
|
||||
labels['MA'] = _("ICE")
|
||||
return labels
|
||||
Loading…
Add table
Add a link
Reference in a new issue