changeset 4559797d847c in modules/product:default
details: https://hg.tryton.org/modules/product?cmd=changeset;node=4559797d847c
description:
        Add test on context of company multivalue target fields

        issue10067
        review333851026
diffstat:

 product.py            |  18 +++++++++++++++---
 tests/test_product.py |   4 +++-
 2 files changed, 18 insertions(+), 4 deletions(-)

diffs (57 lines):

diff -r 6376c01b4b09 -r 4559797d847c product.py
--- a/product.py        Sat Feb 27 18:16:28 2021 +0100
+++ b/product.py        Fri Mar 05 15:49:19 2021 +0100
@@ -590,7 +590,11 @@
     "Product List Price"
     __name__ = 'product.list_price'
     template = fields.Many2One(
-        'product.template', "Template", ondelete='CASCADE', select=True)
+        'product.template', "Template", ondelete='CASCADE', select=True,
+        context={
+            'company': Eval('company', -1),
+            },
+        depends=['company'])
     list_price = fields.Numeric("List Price", digits=price_digits)
 
     @classmethod
@@ -616,7 +620,11 @@
     "Product Cost Price Method"
     __name__ = 'product.cost_price_method'
     template = fields.Many2One(
-        'product.template', "Template", ondelete='CASCADE', select=True)
+        'product.template', "Template", ondelete='CASCADE', select=True,
+        context={
+            'company': Eval('company', -1),
+            },
+        depends=['company'])
     cost_price_method = fields.Selection(
         'get_cost_price_methods', "Cost Price Method")
 
@@ -672,7 +680,11 @@
     "Product Cost Price"
     __name__ = 'product.cost_price'
     product = fields.Many2One(
-        'product.product', "Product", ondelete='CASCADE', select=True)
+        'product.product', "Product", ondelete='CASCADE', select=True,
+        context={
+            'company': Eval('company', -1),
+            },
+        depends=['company'])
     cost_price = fields.Numeric(
         "Cost Price", digits=price_digits)
 
diff -r 6376c01b4b09 -r 4559797d847c tests/test_product.py
--- a/tests/test_product.py     Sat Feb 27 18:16:28 2021 +0100
+++ b/tests/test_product.py     Fri Mar 05 15:49:19 2021 +0100
@@ -10,8 +10,10 @@
 from trytond.transaction import Transaction
 from trytond.pool import Pool
 
+from trytond.modules.company.tests import CompanyMultiValueTestMixin
 
-class ProductTestCase(ModuleTestCase):
+
+class ProductTestCase(CompanyMultiValueTestMixin, ModuleTestCase):
     'Test Product module'
     module = 'product'
 

Reply via email to