Skip to content

Commit

Permalink
[FIX] mis_builder: add sudo to access field_id due missing permissions
Browse files Browse the repository at this point in the history
Resolve a permission issue when creating report periods with a user without admin rights.
  • Loading branch information
JordiBForgeFlow authored and MiquelRForgeFlow committed Feb 8, 2024
1 parent cf03aa9 commit e31914f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mis_builder/models/mis_report_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,11 @@ def _compute_allowed_cmpcol_ids(self):
def _check_source_aml_model_id(self):
for record in self:
if record.source_aml_model_id:
record_model = record.source_aml_model_id.field_id.filtered(
lambda r: r.name == "account_id"
).relation
record_model = (
record.source_aml_model_id.sudo()
.field_id.filtered(lambda r: r.name == "account_id")
.relation
)
report_account_model = record.report_id.account_model
if record_model != report_account_model:
raise ValidationError(
Expand Down
1 change: 1 addition & 0 deletions mis_builder/readme/newsfragments/596.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Resolve a permission issue when creating report periods with a user without admin rights.

0 comments on commit e31914f

Please sign in to comment.