From ab6d9ea6854610868e2c2c928f24fd95d43ce995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 5 Mar 2021 15:49:19 +0100 Subject: [PATCH] Add test on context of company multivalue target fields issue10067 review333851026 --- party.py | 6 +++++- tests/test_account_credit_limit.py | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/party.py b/party.py index 8c25f02606..f6aaaad615 100644 --- a/party.py +++ b/party.py @@ -134,7 +134,11 @@ class PartyCreditLimitAmount(ModelSQL, CompanyValueMixin): "Party Credit Limit Amount" __name__ = 'party.party.credit_limit_amount' party = fields.Many2One( - 'party.party', "Party", ondelete='CASCADE', select=True) + 'party.party', "Party", ondelete='CASCADE', select=True, + context={ + 'company': Eval('company', -1), + }, + depends=['company']) credit_limit_amount = fields.Numeric( "Credit Limit Amount", digits=(16, Eval('credit_limit_digits', 2)), depends=['credit_limit_digits']) diff --git a/tests/test_account_credit_limit.py b/tests/test_account_credit_limit.py index d415e962e4..ed8dd33198 100644 --- a/tests/test_account_credit_limit.py +++ b/tests/test_account_credit_limit.py @@ -8,11 +8,12 @@ from trytond.tests.test_tryton import ModuleTestCase, with_transaction from trytond.pool import Pool from trytond.exceptions import UserError, UserWarning -from trytond.modules.company.tests import create_company, set_company +from trytond.modules.company.tests import ( + create_company, set_company, CompanyMultiValueTestMixin) from trytond.modules.account.tests import create_chart, get_fiscalyear -class AccountCreditLimitTestCase(ModuleTestCase): +class AccountCreditLimitTestCase(CompanyMultiValueTestMixin, ModuleTestCase): 'Test AccountCreditLimit module' module = 'account_credit_limit' extras = ['account_dunning']