Add cache to fiscalyear find, test state and return instance
This commit is contained in:
@@ -132,6 +132,8 @@ class ECSalesListContext(ModelView):
|
||||
pool = Pool()
|
||||
FiscalYear = pool.get('account.fiscalyear')
|
||||
context = Transaction().context
|
||||
return context.get(
|
||||
'fiscalyear',
|
||||
FiscalYear.find(context.get('company'), exception=False))
|
||||
if 'fiscalyear' not in context:
|
||||
fiscalyear = FiscalYear.find(
|
||||
cls.default_company(), exception=False, test_state=False)
|
||||
return fiscalyear.id if fiscalyear else None
|
||||
return context['fiscalyear']
|
||||
|
||||
Reference in New Issue
Block a user