Add company domain to fiscalyear of reporting contexts

issue11206
review376651002
This commit is contained in:
Sergi Almacellas Abellana
2022-04-26 17:47:16 +02:00
parent c0d73996e8
commit 45eac34ee5
+17 -1
View File
@@ -2035,7 +2035,11 @@ class GeneralLedgerAccountContext(ModelView):
'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')),
@@ -2119,6 +2123,12 @@ class GeneralLedgerAccountContext(ModelView):
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
@@ -2586,6 +2596,12 @@ class IncomeStatementContext(ModelView):
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