diff --git a/mis_builder/models/mis_report.py b/mis_builder/models/mis_report.py index 146c0abcc..dd04bbcce 100644 --- a/mis_builder/models/mis_report.py +++ b/mis_builder/models/mis_report.py @@ -475,9 +475,11 @@ def _compute_all_kpi_ids(self): @api.depends("move_lines_source") def _compute_account_model(self): for record in self: - record.account_model = record.move_lines_source.field_id.filtered( - lambda r: r.name == "account_id" - ).relation + record.account_model = ( + record.move_lines_source.sudo() + .field_id.filtered(lambda r: r.name == "account_id") + .relation + ) @api.onchange("subkpi_ids") def _on_change_subkpi_ids(self): diff --git a/mis_builder/models/mis_report_instance.py b/mis_builder/models/mis_report_instance.py index 42ce48fdc..ca41731fe 100644 --- a/mis_builder/models/mis_report_instance.py +++ b/mis_builder/models/mis_report_instance.py @@ -369,7 +369,7 @@ def _onchange_source(self): def _get_aml_model_name(self): self.ensure_one() if self.source == SRC_ACTUALS: - return self.report_id.move_lines_source.model + return self.report_id.move_lines_source.sudo().model elif self.source == SRC_ACTUALS_ALT: return self.source_aml_model_name return False diff --git a/mis_builder/readme/CONTRIBUTORS.rst b/mis_builder/readme/CONTRIBUTORS.rst index 72531f707..4f4aa67b8 100644 --- a/mis_builder/readme/CONTRIBUTORS.rst +++ b/mis_builder/readme/CONTRIBUTORS.rst @@ -24,3 +24,4 @@ * `CorporateHub `__ * Alexey Pelykh +* Jairo Llopis (https://www.moduon.team/) diff --git a/mis_builder/readme/newsfragments/access-error.fix b/mis_builder/readme/newsfragments/access-error.fix new file mode 100644 index 000000000..e739379fd --- /dev/null +++ b/mis_builder/readme/newsfragments/access-error.fix @@ -0,0 +1 @@ +Fix access error when previewing or printing report.