Skip to content

Commit

Permalink
[FIX] connector_search_engine: if the user doesn't have the rights on…
Browse files Browse the repository at this point in the history
… se_binding the compute, write and unlink will fail
  • Loading branch information
jdoutreloux authored and ThomasBinsfeld committed May 21, 2024
1 parent dab5e3e commit 0a0fe59
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions connector_search_engine/models/se_indexable_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class SeIndexableRecord(models.AbstractModel):
string="Seacrh Engine Bindings",
comodel_name="se.binding",
compute="_compute_binding_ids",
compute_sudo=True,
)
count_se_binding_total = fields.Integer(compute="_compute_count_binding")
count_se_binding_done = fields.Integer(compute="_compute_count_binding")
Expand Down Expand Up @@ -170,8 +171,8 @@ def _se_mark_to_update(self, indexes: SeIndex | None = None) -> None:
bindings.write({"state": "to_recompute"})

def unlink(self):
bindings = self._get_bindings()
bindings.write(
bindings = self.sudo()._get_bindings()
bindings.sudo().write(
{
"state": "to_delete",
"res_id": False,
Expand All @@ -186,7 +187,7 @@ def write(self, vals):
# if the record is archived then unarchived while the binding
# are not already deleted we reset the state to_recompute
new_state = "to_recompute" if vals["active"] else "to_delete"
bindings.write(
bindings.sudo().write(
{
"state": new_state,
}
Expand Down

0 comments on commit 0a0fe59

Please sign in to comment.