diff --git a/CHANGELOG b/CHANGELOG
index 6a698090a5..7d368a882c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,5 @@
+* Add fr_siren and fr_siret identifiers
+* Add optional address to identifiers
* Add autonomous city as subdivision type for Spain
* Add support for Python 3.10
* Remove support for Python 3.6
diff --git a/address.py b/address.py
index e60de7559f..c1e61cc490 100644
--- a/address.py
+++ b/address.py
@@ -58,6 +58,13 @@ class Address(DeactivableMixin, sequence_ordered(), ModelSQL, ModelView):
depends=['country', 'subdivision_types'])
full_address = fields.Function(fields.Text('Full Address'),
'get_full_address')
+ identifiers = fields.One2Many(
+ 'party.identifier', 'address', "Identifiers",
+ domain=[
+ ('party', '=', Eval('party')),
+ ('type', 'in', ['fr_siret']),
+ ],
+ depends=['party'])
@classmethod
def __setup__(cls):
diff --git a/address.xml b/address.xml
index 41e7a7921d..7881368bfc 100644
--- a/address.xml
+++ b/address.xml
@@ -22,6 +22,13 @@ this repository contains the full copyright notices and license terms. -->
form
address_form
+
+
+ party.address
+ form
+ address_form_simple
+
+
Addresses
party.address
diff --git a/party.py b/party.py
index d842db3492..6e5b6a5cdd 100644
--- a/party.py
+++ b/party.py
@@ -457,8 +457,8 @@ IDENTIFIER_TYPES = [
('fi_ytunnus', "Finnish Business Identifier"),
('fr_nif', "French Tax Identification Number"),
('fr_nir', "French Personal Identification Number"),
- # TODO: remove from party_siren
- # ('fr_siren', "French Company Identification Number"),
+ ('fr_siren', "French Company Identification Number"),
+ ('fr_siret', "French Company Establishment Identification Number"),
('fr_tva', "French VAT Number"),
('gb_nhs',
"United Kingdom National Health Service Patient Identifier"),
@@ -618,8 +618,21 @@ class Identifier(sequence_ordered(), DeactivableMixin, ModelSQL, ModelView):
party = fields.Many2One('party.party', 'Party', ondelete='CASCADE',
required=True, select=True,
help="The party identified by this record.")
+ address = fields.Many2One(
+ 'party.address', "Address", ondelete='CASCADE', select=True,
+ states={
+ 'required': Eval('type_address', False),
+ 'invisible': ~Eval('type_address', True),
+ },
+ domain=[
+ ('party', '=', Eval('party', -1)),
+ ],
+ depends=['party', 'type_address'],
+ help="The address identified by this record.")
type = fields.Selection('get_types', 'Type')
type_string = type.translated('type')
+ type_address = fields.Function(
+ fields.Boolean("Type of Address"), 'on_change_with_type_address')
code = fields.Char('Code', required=True)
@classmethod
@@ -667,6 +680,14 @@ class Identifier(sequence_ordered(), DeactivableMixin, ModelSQL, ModelView):
configuration = Configuration(1)
return [(None, '')] + configuration.get_identifier_types()
+ @classmethod
+ def _type_addresses(cls):
+ return {'fr_siret'}
+
+ @fields.depends('type')
+ def on_change_with_type_address(self, name=None):
+ return self.type in self._type_addresses()
+
@fields.depends('type', 'code')
def on_change_with_code(self):
if self.type and '_' in self.type:
diff --git a/view/address_form.xml b/view/address_form.xml
index 4b1f5a83cc..4786007af9 100644
--- a/view/address_form.xml
+++ b/view/address_form.xml
@@ -14,20 +14,26 @@ this repository contains the full copyright notices and license terms. -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/view/address_form_simple.xml b/view/address_form_simple.xml
new file mode 100644
index 0000000000..4b1f5a83cc
--- /dev/null
+++ b/view/address_form_simple.xml
@@ -0,0 +1,33 @@
+
+
+
diff --git a/view/identifier_form.xml b/view/identifier_form.xml
index 0a58dfdad7..cca2122d9c 100644
--- a/view/identifier_form.xml
+++ b/view/identifier_form.xml
@@ -14,4 +14,7 @@ this repository contains the full copyright notices and license terms. -->
+
+
+
diff --git a/view/identifier_list.xml b/view/identifier_list.xml
index 3d4d81d17d..7a43062227 100644
--- a/view/identifier_list.xml
+++ b/view/identifier_list.xml
@@ -2,7 +2,8 @@
-
-
-
+
+
+
+
diff --git a/view/identifier_list_sequence.xml b/view/identifier_list_sequence.xml
index 53663d0b1f..dbd2037a6c 100644
--- a/view/identifier_list_sequence.xml
+++ b/view/identifier_list_sequence.xml
@@ -2,7 +2,8 @@
-
-
-
+
+
+
+
diff --git a/view/party_form.xml b/view/party_form.xml
index 1b5725f03b..ffdf214a79 100644
--- a/view/party_form.xml
+++ b/view/party_form.xml
@@ -18,7 +18,7 @@ this repository contains the full copyright notices and license terms. -->
+ view_ids="party.address_view_form_simple,party.address_view_tree_sequence"/>