From f96e0c8e69ea638d9bb2ce7640d54c58eacf81eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 10 Apr 2021 23:46:23 +0200 Subject: [PATCH] Check rule only if _check_access is set and enforce companies rule issue4080 review343891009 --- dunning.py | 5 +---- dunning.xml | 10 +++++----- tests/test_account_dunning.py | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/dunning.py b/dunning.py index b6109d75ff..d9f40e9118 100644 --- a/dunning.py +++ b/dunning.py @@ -77,10 +77,7 @@ class Dunning(ModelSQL, ModelView): __name__ = 'account.dunning' company = fields.Many2One('company.company', 'Company', required=True, help="Make the dunning belong to the company.", - select=True, domain=[ - ('id', If(Eval('context', {}).contains('company'), '=', '!='), - Eval('context', {}).get('company', -1)), - ], + select=True, states=_STATES, depends=_DEPENDS) line = fields.Many2One('account.move.line', 'Line', required=True, help="The receivable line to dun for.", diff --git a/dunning.xml b/dunning.xml index 7bc72508fc..79d7d4e348 100644 --- a/dunning.xml +++ b/dunning.xml @@ -225,16 +225,16 @@ this repository contains the full copyright notices and license terms. --> - - User in company + + User in companies - + - + diff --git a/tests/test_account_dunning.py b/tests/test_account_dunning.py index cf07697dea..ef61150d45 100644 --- a/tests/test_account_dunning.py +++ b/tests/test_account_dunning.py @@ -7,10 +7,10 @@ from trytond.tests.test_tryton import ModuleTestCase from trytond.tests.test_tryton import doctest_teardown from trytond.tests.test_tryton import doctest_checker -from trytond.modules.company.tests import CompanyMultiValueTestMixin +from trytond.modules.company.tests import CompanyTestMixin -class AccountDunningTestCase(CompanyMultiValueTestMixin, ModuleTestCase): +class AccountDunningTestCase(CompanyTestMixin, ModuleTestCase): 'Test AccountDunning module' module = 'account_dunning'