Cédric Krier pushed to branch branch/default at Tryton / Tryton
Commits:
1c13fb73 by Cédric Krier at 2022-12-30T11:59:28+01:00
Update fiscal year when changing company of a budget
- - - - -
1 changed file:
- modules/account_budget/account.py
Changes:
=====================================
modules/account_budget/account.py
=====================================
@@ -333,8 +333,18 @@
def default_fiscalyear(cls):
pool = Pool()
FiscalYear = pool.get('account.fiscalyear')
- context = Transaction().context
- return FiscalYear.find(context.get('company'), exception=False)
+ return FiscalYear.find(cls.default_company(), exception=False)
+
+ @fields.depends('company', 'fiscalyear')
+ def on_change_company(self):
+ pool = Pool()
+ FiscalYear = pool.get('account.fiscalyear')
+ if self.company:
+ if not self.fiscalyear or self.fiscalyear.company != self.company:
+ self.fiscalyear = FiscalYear.find(
+ self.company.id, exception=False)
+ else:
+ self.fiscalyear = None
def get_rec_name(self, name):
return '%s - %s' % (self.name, self.fiscalyear.rec_name)
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/1c13fb734c54f3277e538dbc3efa984f5c1d56c4
--
View it on Heptapod:
https://foss.heptapod.net/tryton/tryton/-/commit/1c13fb734c54f3277e538dbc3efa984f5c1d56c4
You're receiving this email because of your account on foss.heptapod.net.