Allow customization of the types of identifiers permitted on the address

Closes #14247
This commit is contained in:
Cédric Krier committed 2025-09-19 17:24:36 +02:00
1 parent 4fbf660b85
commit ffd42a0fc4
1 file changed
+9 -5
+9 -5
View File
@@ -135,11 +135,7 @@ class Address(
full_address = fields.Function(fields.Text('Full Address'),
'get_full_address')
identifiers = fields.One2Many(
'party.identifier', 'address', "Identifiers",
domain=[
('party', '=', Eval('party', -1)),
('type', 'in', ['fr_siret']),
])
'party.identifier', 'address', "Identifiers")
contact_mechanisms = fields.One2Many(
'party.contact_mechanism', 'address', "Contact Mechanisms",
domain=[
@@ -155,6 +151,10 @@ class Address(
autocomplete_postal_code=RPC(instantiate=0, cache=dict(days=1)),
autocomplete_city=RPC(instantiate=0, cache=dict(days=1)),
)
cls.identifiers.domain = [
('party', '=', Eval('party', -1)),
('type', 'in', list(cls._type_identifiers())),
]
@classmethod
def __register__(cls, module_name):
@@ -363,6 +363,10 @@ class Address(
substitutions[key.upper()] = value.upper()
return substitutions
@classmethod
def _type_identifiers(cls):
return {'fr_siret'}
@classmethod
def _strip(cls, value, doublespace=False):
value = re.sub(