diff --git a/l10n_fr_siret/README.rst b/l10n_fr_siret/README.rst index c5f44308e..135cb1b7c 100644 --- a/l10n_fr_siret/README.rst +++ b/l10n_fr_siret/README.rst @@ -57,6 +57,9 @@ The warning banner is displayed on the partner form view if another partner: - if the partner is attached to a specific company: is in the same company or is not attached to a specific company, - if the partner is not attached to a specific company: is in any company or not attached to a specific company. +On the country form, users will be able to select if SIREN/SIRET fields have to be displayed or not +on the partner's form when the country is selected. + Bug Tracker =========== diff --git a/l10n_fr_siret/__manifest__.py b/l10n_fr_siret/__manifest__.py index ff4e37d99..5f88de45f 100644 --- a/l10n_fr_siret/__manifest__.py +++ b/l10n_fr_siret/__manifest__.py @@ -16,6 +16,7 @@ "data": [ "views/res_partner.xml", "views/res_company.xml", + "views/res_country.xml", ], "demo": ["demo/partner_demo.xml"], "post_init_hook": "set_siren_nic", diff --git a/l10n_fr_siret/i18n/fr.po b/l10n_fr_siret/i18n/fr.po index e9e68acdf..d688a274e 100644 --- a/l10n_fr_siret/i18n/fr.po +++ b/l10n_fr_siret/i18n/fr.po @@ -89,6 +89,12 @@ msgstr "Partenaire avec le même SIREN" msgid "SIREN" msgstr "SIREN" +#. module: l10n_fr_siret +#: model:ir.model.fields,field_description:l10n_fr_siret.field_res_partner__show_siret_fields +#: model:ir.model.fields,field_description:l10n_fr_siret.field_res_users__show_siret_fields +msgid "Show siret fields" +msgstr "Afficher les champs SIRET" + #. module: l10n_fr_siret #: model:ir.model.fields,field_description:l10n_fr_siret.field_res_company__siret #: model:ir.model.fields,field_description:l10n_fr_siret.field_res_partner__siret diff --git a/l10n_fr_siret/i18n/l10n_fr_siret.pot b/l10n_fr_siret/i18n/l10n_fr_siret.pot index 83aabd1a6..513da403c 100644 --- a/l10n_fr_siret/i18n/l10n_fr_siret.pot +++ b/l10n_fr_siret/i18n/l10n_fr_siret.pot @@ -85,6 +85,12 @@ msgstr "" msgid "SIREN" msgstr "" +#. module: l10n_fr_siret +#: model:ir.model.fields,field_description:l10n_fr_siret.field_res_partner__show_siret_fields +#: model:ir.model.fields,field_description:l10n_fr_siret.field_res_users__show_siret_fields +msgid "Show siret fields" +msgstr "" + #. module: l10n_fr_siret #: model:ir.model.fields,field_description:l10n_fr_siret.field_res_company__siret #: model:ir.model.fields,field_description:l10n_fr_siret.field_res_partner__siret diff --git a/l10n_fr_siret/models/__init__.py b/l10n_fr_siret/models/__init__.py index e2356f517..566d0c23a 100644 --- a/l10n_fr_siret/models/__init__.py +++ b/l10n_fr_siret/models/__init__.py @@ -1,2 +1,3 @@ from . import res_partner from . import res_company +from . import res_country diff --git a/l10n_fr_siret/models/res_country.py b/l10n_fr_siret/models/res_country.py new file mode 100644 index 000000000..d0fd5bcb9 --- /dev/null +++ b/l10n_fr_siret/models/res_country.py @@ -0,0 +1,11 @@ +# Copyright 2024 Foodles (https://www.foodles.co/). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + + +from odoo import fields, models + + +class ResCountry(models.Model): + _inherit = "res.country" + + show_siret_fields = fields.Boolean(default=True) diff --git a/l10n_fr_siret/models/res_partner.py b/l10n_fr_siret/models/res_partner.py index 99c12a423..413a702ee 100644 --- a/l10n_fr_siret/models/res_partner.py +++ b/l10n_fr_siret/models/res_partner.py @@ -137,6 +137,14 @@ def _address_fields(self): string="Partner with same SIREN", compute_sudo=True, ) + show_siret_fields = fields.Boolean(compute="_compute_show_siret_fields") + + @api.depends("country_id", "is_company", "parent_is_company") + def _compute_show_siret_fields(self): + for record in self: + record.show_siret_fields = record.country_id.show_siret_fields and ( + record.is_company or record.parent_is_company + ) @api.depends("siren", "company_id") def _compute_same_siren_partner_id(self): diff --git a/l10n_fr_siret/readme/USAGE.rst b/l10n_fr_siret/readme/USAGE.rst index 1c637b14b..66944c404 100644 --- a/l10n_fr_siret/readme/USAGE.rst +++ b/l10n_fr_siret/readme/USAGE.rst @@ -8,3 +8,6 @@ The warning banner is displayed on the partner form view if another partner: - has the same SIREN, - if the partner is attached to a specific company: is in the same company or is not attached to a specific company, - if the partner is not attached to a specific company: is in any company or not attached to a specific company. + +On the country form, users will be able to select if SIREN/SIRET fields have to be displayed or not +on the partner's form when the country is selected. diff --git a/l10n_fr_siret/static/description/index.html b/l10n_fr_siret/static/description/index.html index a809c532a..c6d223d19 100644 --- a/l10n_fr_siret/static/description/index.html +++ b/l10n_fr_siret/static/description/index.html @@ -1,4 +1,3 @@ -
@@ -403,6 +402,8 @@On the country form, users will be able to select if SIREN/SIRET fields have to be displayed or not +on the partner’s form when the country is selected.