Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix permissions issue when clicking phonecalls in crm.lead #596

Open
wants to merge 2 commits into
base: 16.0
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crm_phonecall/models/crm_lead.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _compute_phonecall_count(self):

def button_open_phonecall(self):
self.ensure_one()
action = self.env.ref("crm_phonecall.crm_case_categ_phone_incoming0")
action = self.env.ref("crm_phonecall.crm_case_categ_phone_incoming0").sudo()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usual thing to do in these cases is to use _for_xml_id method instead of ir.model.data for reading in one shot without permissions problem the action.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for correcting. I pushed a commit with the correction applied.

action_dict = action.read()[0] if action else {}
action_dict["context"] = safe_eval(action_dict.get("context", "{}"))
action_dict["context"].update(
Expand Down
Loading