Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions spp_approval/views/approval_definition_views_cel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<field
name="cel_condition"
widget="ace"
options="{'mode': 'text'}"
options="{'mode': 'python'}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

CEL (Common Expression Language) uses C-style operators such as &&, ||, and !, which are not valid in Python. Using python mode will cause the CodeEditor to highlight these as syntax errors, leading to a poor user experience. Since Odoo 19's CodeEditor supports javascript, it is a much better fit for CEL expressions as the syntax is largely compatible.

Suggested change
options="{'mode': 'python'}"
options="{'mode': 'javascript'}"

invisible="not use_cel_condition"
placeholder="record.amount > 10000"
/>
Expand All @@ -42,7 +42,7 @@
<field
name="cel_reviewer_expression"
widget="ace"
options="{'mode': 'text'}"
options="{'mode': 'python'}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

CEL (Common Expression Language) uses C-style operators such as &&, ||, and !, which are not valid in Python. Using python mode will cause the CodeEditor to highlight these as syntax errors, leading to a poor user experience. Since Odoo 19's CodeEditor supports javascript, it is a much better fit for CEL expressions as the syntax is largely compatible.

Suggested change
options="{'mode': 'python'}"
options="{'mode': 'javascript'}"

invisible="not use_cel_reviewer"
placeholder="record.manager_id.user_id.id"
/>
Expand Down
11 changes: 11 additions & 0 deletions spp_hide_menus_base/models/hide_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ def hide_menu(self, menu_id=None):
)
rec.state = "hide"

def _reapply_hide(self):
"""Re-apply hiding when module upgrade reset group_ids via XML."""
try:
hide_group = self.env.ref("spp_hide_menus_base.group_hide_menus_user")
except ValueError:
hide_group = self.env.ref("spp_hide_menus_base.group_menu_visibility")
for rec in self:
if rec.menu_id and hide_group not in rec.menu_id.group_ids:
rec.default_group_ids = rec.menu_id.group_ids
rec.menu_id.write({"group_ids": [Command.set([hide_group.id])]})

def show_menu(self):
for rec in self:
if rec.state == "hide" and rec.menu_id:
Expand Down
4 changes: 4 additions & 0 deletions spp_hide_menus_base/models/ir_module_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ def hide_menus(self):
hidden_menu.hide_menu()
elif hidden_menus.state == "show":
hidden_menus.hide_menu()
elif hidden_menus.state == "hide":
# Module upgrade may have reset group_ids via XML
# (noupdate="0"). Re-apply hiding if stale.
hidden_menus._reapply_hide()

def next(self):
# Call your menu hiding logic first
Expand Down
Loading