From a637cf9fb0af271a0838bec62df304ccd19654f0 Mon Sep 17 00:00:00 2001 From: "Ronald Portier (Therp BV)" Date: Mon, 15 May 2023 09:30:54 +0200 Subject: [PATCH] [FIX] *+xaf_auditfile_export: use correct company in name Currently the export record is created with the current company in the environment (self.env.company), but the default company for the user (self.env.user.company_id) is applied to the name generated. This can and will lead to mismatches. This fix will consistently use self.env.company. --- l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py b/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py index 44662b136..69262964a 100644 --- a/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py +++ b/l10n_nl_xaf_auditfile_export/models/xaf_auditfile_export.py @@ -81,7 +81,7 @@ def _compute_fiscalyear_name(self): @api.model def default_get(self, fields_list): defaults = super().default_get(fields_list) - company = self.env.user.company_id + company = self.env.company fy_dates = company.compute_fiscalyear_dates(datetime.now()) defaults.setdefault("date_start", fy_dates["date_from"]) defaults.setdefault("date_end", fy_dates["date_to"]) @@ -96,7 +96,6 @@ def default_get(self, fields_list): "current_datetime": datetime.now().strftime("%Y"), }, ) - return defaults @api.constrains("date_start", "date_end")