Skip to content

Commit 08d933c

Browse files
committed
[FIX] crm_claim_analytic: do not require sudo to click claim smartbutton
1 parent 1bf1baf commit 08d933c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

crm_claim_analytic/models/crm_claim.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ def _compute_analytic_amount(self):
3232

3333
def button_account_analytic_line_action(self):
3434
self.ensure_one()
35-
action = self.env.ref("analytic.account_analytic_line_action_entries")
36-
action_dict = action.read()[0] if action else {}
37-
action_dict["context"] = safe_eval(action_dict.get("context", "{}"))
38-
action_dict["context"].update(
35+
action = self.env["ir.actions.act_window"]._for_xml_id(
36+
"analytic.account_analytic_line_action_entries"
37+
)
38+
action["context"] = safe_eval(action.get("context", "{}"))
39+
action["context"].update(
3940
{
4041
"search_default_claim_id": self.id,
4142
"default_claim_id": self.id,
@@ -48,5 +49,5 @@ def button_account_analytic_line_action(self):
4849
safe_eval(action.domain or "[]"),
4950
]
5051
)
51-
action_dict.update({"domain": domain})
52-
return action_dict
52+
action.update({"domain": domain})
53+
return action

0 commit comments

Comments
 (0)