Skip to content

Commit

Permalink
[FIX] base_export_manager: Avoid access error when using export profile
Browse files Browse the repository at this point in the history
Steps to reproduce:

- Create an export profile in any model.
- Login with a user without setting permissions.
- Go to export popup on that model.
- Try to select the saved export profile.

You'll get an access error.

Using sudo for computed/related stuff linked to ir.model,  we avoid
the problem.

TT44721
  • Loading branch information
pedrobaeza committed Aug 8, 2023
1 parent a54b7dc commit a6f2bf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions base_export_manager/models/ir_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class IrExports(models.Model):
store=True,
inverse="_inverse_model_id",
compute="_compute_model_id",
compute_sudo=True,
domain=[("transient", "=", False)],
help="Database model to export.",
)
Expand Down
10 changes: 7 additions & 3 deletions base_export_manager/models/ir_exports_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class IrExportsLine(models.Model):
name = fields.Char(
store=True,
compute="_compute_name",
compute_sudo=True,
inverse="_inverse_name",
help="Field's technical name.",
)
Expand All @@ -33,13 +34,16 @@ class IrExportsLine(models.Model):
"First model",
readonly=True,
related="export_id.model_id",
related_sudo=True,
)
model2_id = fields.Many2one(
"ir.model", "Second model", compute="_compute_model2_id"
"ir.model", "Second model", compute="_compute_model2_id", compute_sudo=True
)
model3_id = fields.Many2one(
"ir.model", "Third model", compute="_compute_model3_id", compute_sudo=True
)
model3_id = fields.Many2one("ir.model", "Third model", compute="_compute_model3_id")
model4_id = fields.Many2one(
"ir.model", "Fourth model", compute="_compute_model4_id"
"ir.model", "Fourth model", compute="_compute_model4_id", compute_sudo=True
)
sequence = fields.Integer()
label = fields.Char(compute="_compute_label")
Expand Down

0 comments on commit a6f2bf0

Please sign in to comment.