diff --git a/joint_buying_product/i18n/fr.po b/joint_buying_product/i18n/fr.po index ebd112e9..b4643eba 100644 --- a/joint_buying_product/i18n/fr.po +++ b/joint_buying_product/i18n/fr.po @@ -2321,12 +2321,6 @@ msgstr "URL du document en ligne qui sera ajouté automatiquement dans l'email e msgid "Unavailable Product (450gr) (Global)" msgstr "Article indisponible (450gr) (Global)" -#. module: joint_buying_product -#: code:addons/joint_buying_product/models/product_product.py:175 -#, python-format -msgid "Unimplemented Feature" -msgstr "Fonctionnalité non implémentée" - #. module: joint_buying_product #: model_terms:ir.ui.view,arch_db:joint_buying_product.view_joint_buying_purchase_order_form #: model_terms:ir.ui.view,arch_db:joint_buying_product.view_joint_buying_purchase_order_grouped_form @@ -2479,6 +2473,18 @@ msgstr "Vous ne pouvez pas confirmer une commande avec un montant nul." msgid "You can not confirm an order without any lines." msgstr "Vous ne pouvez pas confirmer une commande sans lignes." +#. module: joint_buying_product +#: code:addons/joint_buying_product/models/product_product.py:180 +#, python-format +msgid "You can not change the relation between a global product and a local product if you sale it." +msgstr "Vous ne pouvez pas changer le lien entre un produit global et un produit local si vous en êtes le fournisseur." + +#. module: joint_buying_product +#: code:addons/joint_buying_product/models/product_product.py:231 +#, python-format +msgid "You can not update the data of the product that belong to %s." +msgstr "Vous ne pouvez pas mettre à jour les données d'un produit qui appartient à %s." + #. module: joint_buying_product #: code:addons/joint_buying_product/models/product_product.py:136 #, python-format diff --git a/joint_buying_product/models/product_product.py b/joint_buying_product/models/product_product.py index d0a51352..6809cb5d 100644 --- a/joint_buying_product/models/product_product.py +++ b/joint_buying_product/models/product_product.py @@ -5,7 +5,7 @@ from datetime import timedelta from odoo import _, api, fields, models -from odoo.exceptions import ValidationError +from odoo.exceptions import AccessError, ValidationError from odoo.addons.joint_buying_base.models.res_partner import ( _JOINT_BUYING_PARTNER_CONTEXT, @@ -223,6 +223,16 @@ def update_joint_buying_product(self): global_product = product.joint_buying_product_id.with_context( joint_buying=True, joint_buying_local_to_global=True ) + if ( + product.company_id.joint_buying_partner_id + != global_product.joint_buying_partner_id + ): + raise AccessError( + _( + "You can not update the data of the product that belong to %s." + % global_product.joint_buying_partner_id.name + ) + ) global_product.write(vals) def _prepare_joint_buying_product(self, action):