From 59a0a8c8a712d1dbcbad91cb429aef5142132233 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 25 Oct 2024 17:06:42 +0200 Subject: [PATCH] Enforce company of promotion using the sale line company field --- modules/sale_promotion/sale.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/modules/sale_promotion/sale.py b/modules/sale_promotion/sale.py index 891d6934b9..8320fa2598 100644 --- a/modules/sale_promotion/sale.py +++ b/modules/sale_promotion/sale.py @@ -74,12 +74,11 @@ class Line(metaclass=PoolMeta): draft_unit_price = fields.Numeric('Draft Unit Price', digits=price_digits, readonly=True) - promotion = fields.Many2One('sale.promotion', 'Promotion', + promotion = fields.Many2One('sale.promotion', "Promotion", ondelete='RESTRICT', domain=[ - ('company', '=', Eval('_parent_sale', {}).get('company', -1)), - ], - depends={'sale'}) + ('company', '=', Eval('company', -1)), + ]) class Promotion(