Skip to content

fix(spp_dms): fix DMS app visibility and hide deprecated group from UI#176

Open
anthonymarkQA wants to merge 1 commit into19.0from
fix/dms-deprecated-role
Open

fix(spp_dms): fix DMS app visibility and hide deprecated group from UI#176
anthonymarkQA wants to merge 1 commit into19.0from
fix/dms-deprecated-role

Conversation

@anthonymarkQA
Copy link
Copy Markdown
Contributor

The DMS app was not appearing on the home screen for users assigned Viewer, Officer, or Manager roles because the main menu was gated on
(deprecated). The current role hierarchy only flows
downward (group_dms_user → group_dms_officer → group_dms_viewer), so none of the active roles implied the deprecated group, making the app invisible to all non-admin users.

Changes:

  • main_view.xml: change menu group gate from group_dms_user to
    group_dms_viewer so any assigned DMS role grants access to the app
  • security.xml: remove privilege_id from group_dms_user so it no
    longer appears in the privilege selector in Settings; the record is
    kept for backwards compatibility with existing data

Why is this change needed?

A blocker to accessing DMS feature

How was the change implemented?

Updating the main view xml to group_dms_viewer from the deprecated group_dms_user

New unit tests

Unit tests executed by the author

How to test manually

  1. Install spp_demo_v2 which auto installs spp_dms
  2. Go to settings/Users&Companies/User Roles
  3. Create a new Role DMS first then save. do not add a group yet. theres an issue i also fixed related to this.
  4. On the new DMS role click add a line and type document.
  5. Notice the Document management user (deprecated) should now be gone.
  6. Assign at least Document viewer to the role
  7. Assign DMS role to Demo_viewer user.
  8. Login as Demo_viewer. should now be able to access DMS feature.

Related links

https://projects.acn.fr/projects/acn-eng/work_packages/978/activity

The DMS app was not appearing on the home screen for users assigned
Viewer, Officer, or Manager roles because the main menu was gated on
 (deprecated). The current role hierarchy only flows
downward (group_dms_user → group_dms_officer → group_dms_viewer),
so none of the active roles implied the deprecated group, making the
app invisible to all non-admin users.

Changes:
- main_view.xml: change menu group gate from  to
   so any assigned DMS role grants access to the app
- security.xml: remove  from  so it no
  longer appears in the privilege selector in Settings; the record is
  kept for backwards compatibility with existing data
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 updates the DMS module by removing the privilege association from the deprecated user group and transitioning the main menu access to the viewer group. Feedback suggests explicitly setting the privilege field to False in the XML to ensure database consistency during upgrades and adding the configuration admin group to the main menu to prevent visibility issues for users with that role.

<record id="group_dms_user" model="res.groups">
<field name="name">User (Deprecated)</field>
<field name="privilege_id" ref="privilege_dms" />
<field
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

To ensure that the privilege_id is actually cleared from existing records in the database during a module upgrade, simply removing the line from the XML is often insufficient in Odoo. In many cases, Odoo retains the existing value in the database if the field is omitted from the record definition during an update. It is recommended to explicitly set the field to False to guarantee it is hidden from the privilege selector as intended.

Suggested change
<field
<field name="privilege_id" eval="False" />
<field

name="DMS"
web_icon="spp_dms,static/description/OpenSPP-Icons-DMS.png"
groups="spp_dms.group_dms_user"
groups="spp_dms.group_dms_viewer"
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

The PR aims to ensure that any assigned DMS role grants access to the application. However, the group_dms_config_admin group (which corresponds to the "Config Access" role in the privilege selector) is not included in this menu's groups attribute and does not inherit from group_dms_viewer. Consequently, users assigned only the "Config Access" role will be unable to see the DMS app on the home screen. You should include this group to ensure all functional DMS roles have visibility of the root menu.

Suggested change
groups="spp_dms.group_dms_viewer"
groups="spp_dms.group_dms_viewer,spp_dms.group_dms_config_admin"

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.85%. Comparing base (98a45a9) to head (ab57260).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             19.0     #176      +/-   ##
==========================================
+ Coverage   71.48%   71.85%   +0.37%     
==========================================
  Files         932      945      +13     
  Lines       54840    55975    +1135     
==========================================
+ Hits        39201    40220    +1019     
- Misses      15639    15755     +116     
Flag Coverage Δ
spp_api_v2_change_request 66.85% <ø> (ø)
spp_base_common 90.26% <ø> (ø)
spp_change_request_v2 75.39% <ø> (+1.15%) ⬆️
spp_cr_types_advanced 0.00% <ø> (ø)
spp_cr_types_base 0.00% <ø> (ø)
spp_dci_demo 69.23% <ø> (ø)
spp_dms 87.89% <ø> (?)
spp_farmer_registry_cr 61.15% <ø> (+0.05%) ⬆️
spp_farmer_registry_demo 54.01% <ø> (+0.62%) ⬆️
spp_mis_demo_v2 74.07% <ø> (+4.05%) ⬆️
spp_programs 64.51% <ø> (ø)
spp_security 66.66% <ø> (ø)
spp_starter_social_registry 0.00% <ø> (ø)
spp_starter_sp_mis 81.25% <ø> (ø)
spp_studio_change_requests 84.67% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 25 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.

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.

1 participant