changeset c3476da72e5c in modules/sale_promotion:default
details:
https://hg.tryton.org/modules/sale_promotion?cmd=changeset;node=c3476da72e5c
description:
Add test on context of company multivalue target fields
issue10067
review333851026
diffstat:
sale.py | 14 +++++++++++---
tests/test_sale_promotion.py | 4 +++-
2 files changed, 14 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r e9d77a0c409b -r c3476da72e5c sale.py
--- a/sale.py Sat Feb 27 23:09:53 2021 +0100
+++ b/sale.py Fri Mar 05 15:49:20 2021 +0100
@@ -144,11 +144,19 @@
depends=['quantity'])
unit_digits = fields.Function(fields.Integer('Unit Digits'),
'on_change_with_unit_digits')
- products = fields.Many2Many('sale.promotion-product.product',
- 'promotion', 'product', 'Products')
+ products = fields.Many2Many(
+ 'sale.promotion-product.product', 'promotion', 'product', "Products",
+ context={
+ 'company': Eval('company', -1),
+ },
+ depends=['company'])
categories = fields.Many2Many(
'sale.promotion-product.category', 'promotion', 'category',
- "Categories")
+ "Categories",
+ context={
+ 'company': Eval('company', -1),
+ },
+ depends=['company'])
formula = fields.Char('Formula', required=True,
help=('Python expression that will be evaluated with:\n'
'- unit_price: the original unit_price'))
diff -r e9d77a0c409b -r c3476da72e5c tests/test_sale_promotion.py
--- a/tests/test_sale_promotion.py Sat Feb 27 23:09:53 2021 +0100
+++ b/tests/test_sale_promotion.py Fri Mar 05 15:49:20 2021 +0100
@@ -7,8 +7,10 @@
from trytond.tests.test_tryton import doctest_teardown
from trytond.tests.test_tryton import doctest_checker
+from trytond.modules.company.tests import CompanyMultiValueTestMixin
-class SalePromotionTestCase(ModuleTestCase):
+
+class SalePromotionTestCase(CompanyMultiValueTestMixin, ModuleTestCase):
'Test Sale Promotion module'
module = 'sale_promotion'