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

[16.0][FIX] event_slides: new way to access actions #3078

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
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
28 changes: 17 additions & 11 deletions event_slides/models/event_track.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,26 @@ def _compute_count_courses(self):
def button_show_event_courses(self):
self.ensure_one()
if self.count_courses > 0:
action = self.env.ref("website_slides.slide_channel_action_overview")
action_dict = action and action.read()[0]
action_dict["context"] = safe_eval(action_dict.get("context", "{}"))
action_dict["context"].update(
{
"default_event_id": self.event_id.id,
"search_default_event_id": self.event_id.id,
}
action = self.env["ir.actions.actions"]._for_xml_id(
"website_slides.slide_channel_action_overview"
)
domain = expression.AND(
[
[("id", "in", self.event_id.slides_ids.ids)],
safe_eval(action.domain or "[]"),
safe_eval(action.get("domain") or "[]"),
]
)
action_dict.update({"domain": domain})
return action_dict
context = safe_eval(action.get("context") or "{}")
context.update(
{
"default_event_id": self.event_id.id,
"search_default_event_id": self.event_id.id,
}
)
action.update(
{
"domain": domain,
"context": context,
}
)
return action
Loading