From e2e7da0d2f53125052dae7c4a8f650a0d5deb88a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 8 Aug 2022 22:23:11 +0200 Subject: [PATCH] Add company context to coupon parties field issue11635 review439351003 --- sale.py | 5 ++++- tests/test_module.py | 3 ++- tryton.cfg | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/sale.py b/sale.py index 5ead720a24..a79b8cb989 100644 --- a/sale.py +++ b/sale.py @@ -191,7 +191,10 @@ class Sale(metaclass=PoolMeta): }, depends={'coupon_parties'}) coupon_parties = fields.Function(fields.Many2Many( - 'party.party', None, None, "Coupon Parties"), + 'party.party', None, None, "Coupon Parties", + context={ + 'company': Eval('company', -1), + }), 'on_change_with_coupon_parties') @fields.depends(methods=['_coupon_parties']) diff --git a/tests/test_module.py b/tests/test_module.py index f8d8f28277..dabaec3235 100644 --- a/tests/test_module.py +++ b/tests/test_module.py @@ -1,10 +1,11 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. +from trytond.modules.company.tests import CompanyTestMixin from trytond.tests.test_tryton import ModuleTestCase -class SalePromotionCouponTestCase(ModuleTestCase): +class SalePromotionCouponTestCase(CompanyTestMixin, ModuleTestCase): 'Test Sale Promotion Coupon module' module = 'sale_promotion_coupon' diff --git a/tryton.cfg b/tryton.cfg index 5817e8bc48..1b725932c5 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -1,6 +1,7 @@ [tryton] version=6.5.0 depends: + company ir sale sale_promotion