Skip to content

fix(spp_security,spp_hazard): rename Hazard & Emergency to avoid XML parse error#97

Merged
emjay0921 merged 1 commit into19.0from
fix/hazard-ampersand-clean
Mar 12, 2026
Merged

fix(spp_security,spp_hazard): rename Hazard & Emergency to avoid XML parse error#97
emjay0921 merged 1 commit into19.0from
fix/hazard-ampersand-clean

Conversation

@emjay0921
Copy link
Copy Markdown
Contributor

Why is this change needed?

Odoo 19's ResUserGroupIdsField widget inserts category names into dynamically generated XML without escaping special characters. The & in "Hazard & Emergency" breaks the XML parser when opening the Access Rights tab on the User form (when spp_mis_demo_v2 is installed).

How was the change implemented?

  • Renamed category from "Hazard & Emergency" to "Hazard and Emergency" in:
    • spp_security/security/categories.xml
    • spp_hazard/views/menu.xml
    • spp_hazard/security/compliance.yaml

New unit tests

Unit tests executed by the author

How to test manually

  1. Install spp_mis_demo_v2
  2. Go to Settings > Users & Companies > Users
  3. Select a user and click the "Access Rights" tab
  4. Verify no XML parse error appears

Related links

…parse error

Odoo 19's ResUserGroupIdsField widget inserts category names into
dynamically generated XML without escaping special characters. The &
in "Hazard & Emergency" breaks the XML parser when opening the Access
Rights tab on the User form.
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical XML parsing issue in Odoo 19 that occurred when displaying user access rights. By standardizing the naming convention of the "Hazard & Emergency" category to "Hazard and Emergency", the change ensures that dynamically generated XML content no longer contains unescaped special characters, thereby resolving the parsing failure and improving application stability.

Highlights

  • XML Parsing Fix: Renamed "Hazard & Emergency" to "Hazard and Emergency" across relevant configuration files to prevent XML parsing errors in Odoo 19's ResUserGroupIdsField widget when special characters like & are unescaped.
Changelog
  • spp_hazard/security/compliance.yaml
    • Updated the name field for hazard_main_menu_root from "Hazard & Emergency" to "Hazard and Emergency".
  • spp_hazard/views/menu.xml
    • Modified the name attribute of the hazard_main_menu_root menuitem from "Hazard & Emergency" to "Hazard and Emergency".
  • spp_security/security/categories.xml
    • Updated the comment for the category_spp_hazard record.
    • Changed the name field of the category_spp_hazard record from "Hazard & Emergency" to "Hazard and Emergency".
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses an XML parsing error by renaming 'Hazard & Emergency' to 'Hazard and Emergency' in spp_security/security/categories.xml, spp_hazard/views/menu.xml, and spp_hazard/security/compliance.yaml. This change is intended to prevent an issue with an Odoo 19 widget that does not correctly escape special characters. I have one suggestion to improve asset naming consistency. You might also consider updating the module name in spp_hazard/__manifest__.py to align with these changes, though it is outside the current diff.

<menuitem
id="hazard_main_menu_root"
name="Hazard &amp; Emergency"
name="Hazard and Emergency"
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

While you're updating the name, it would be a good idea to also update the associated icon file name for consistency. The web_icon attribute on the next line refers to OpenSPP-Web-Menu_Hazard__Emergency_Icon.png. Consider renaming this file to reflect the new name (e.g., OpenSPP-Web-Menu_Hazard_and_Emergency_Icon.png) and updating the path in the web_icon attribute. This would improve the overall consistency of the codebase.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.46%. Comparing base (839f83e) to head (8c7f816).
⚠️ Report is 2 commits behind head on 19.0.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0      #97      +/-   ##
==========================================
+ Coverage   70.39%   70.46%   +0.06%     
==========================================
  Files         674      695      +21     
  Lines       37005    38670    +1665     
==========================================
+ Hits        26051    27247    +1196     
- Misses      10954    11423     +469     
Flag Coverage Δ
fastapi 84.21% <ø> (ø)
spp_aggregation 85.06% <ø> (ø)
spp_alerts 94.08% <ø> (ø)
spp_api_v2 79.96% <ø> (ø)
spp_api_v2_change_request 60.29% <ø> (ø)
spp_api_v2_cycles 71.12% <ø> (ø)
spp_api_v2_data 64.41% <ø> (ø)
spp_api_v2_entitlements 70.19% <ø> (ø)
spp_api_v2_gis 71.52% <ø> (ø)
spp_api_v2_products 66.27% <ø> (ø)
spp_api_v2_service_points 70.94% <ø> (ø)
spp_api_v2_simulation 69.61% <ø> (ø)
spp_api_v2_vocabulary 57.26% <ø> (ø)
spp_approval 50.29% <ø> (ø)
spp_area 79.26% <ø> (?)
spp_area_hdx 81.43% <ø> (ø)
spp_audit 64.19% <ø> (?)
spp_base_common 90.26% <ø> (ø)
spp_programs 45.51% <ø> (ø)
spp_security 66.66% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@emjay0921 emjay0921 merged commit fe37be7 into 19.0 Mar 12, 2026
35 checks passed
@emjay0921 emjay0921 deleted the fix/hazard-ampersand-clean branch March 12, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants