[13.0][FIX] account_financial_report: Correct all uses of

self.env.user.company_id. Also move company_id to the
wizard abstract model.
This commit is contained in:
Lois Rilo
2020-10-21 11:44:14 +02:00
committed by chaule97
parent 8b9bad9807
commit 31bed0f68f
11 changed files with 20 additions and 31 deletions

View File

@@ -22,12 +22,6 @@ class GeneralLedgerReportWizard(models.TransientModel):
_description = "General Ledger Report Wizard"
_inherit = "account_financial_report_abstract_wizard"
company_id = fields.Many2one(
comodel_name="res.company",
default=lambda self: self.env.company,
required=False,
string="Company",
)
date_range_id = fields.Many2one(comodel_name="date.range", string="Date range")
date_from = fields.Date(required=True, default=lambda self: self._init_date_from())
date_to = fields.Date(required=True, default=fields.Date.context_today)
@@ -128,8 +122,9 @@ class GeneralLedgerReportWizard(models.TransientModel):
def _init_date_from(self):
"""set start date to begin of current year if fiscal year running"""
today = fields.Date.context_today(self)
last_fsc_month = self.env.user.company_id.fiscalyear_last_month
last_fsc_day = self.env.user.company_id.fiscalyear_last_day
company = self.company_id or self.env.company
last_fsc_month = company.fiscalyear_last_month
last_fsc_day = company.fiscalyear_last_day
if (
today.month < int(last_fsc_month)