changeset df40bc7e722b in modules/account:6.0 details: https://hg.tryton.org/modules/account?cmd=changeset&node=df40bc7e722b description: Add company domain to fiscalyear of reporting contexts
issue11206 review376651002 (grafted from 5df795dd15b2c17120d1d139a4c3670b9262fa01) diffstat: account.py | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diffs (42 lines): diff -r b6a9b60d3e5d -r df40bc7e722b account.py --- a/account.py Fri Apr 15 23:38:00 2022 +0200 +++ b/account.py Tue Apr 26 17:47:16 2022 +0200 @@ -1917,7 +1917,11 @@ 'General Ledger Account Context' __name__ = 'account.general_ledger.account.context' fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year', - required=True) + required=True, + domain=[ + ('company', '=', Eval('company')), + ], + depends=['company']) start_period = fields.Many2One('account.period', 'Start Period', domain=[ ('fiscalyear', '=', Eval('fiscalyear')), @@ -2005,6 +2009,12 @@ def default_to_date(cls): return Transaction().context.get('to_date') + @fields.depends('company', 'fiscalyear', methods=['on_change_fiscalyear']) + def on_change_company(self): + if self.fiscalyear and self.fiscalyear.company != self.company: + self.fiscalyear = None + self.on_change_fiscalyear() + @fields.depends('fiscalyear', 'start_period', 'end_period') def on_change_fiscalyear(self): if (self.start_period @@ -2493,6 +2503,12 @@ def default_comparison(cls): return False + @fields.depends('company', 'fiscalyear', methods=['on_change_fiscalyear']) + def on_change_company(self): + if self.fiscalyear and self.fiscalyear.company != self.company: + self.fiscalyear = None + self.on_change_fiscalyear() + @fields.depends('fiscalyear', 'start_period', 'end_period') def on_change_fiscalyear(self): if (self.start_period