Skip to content

Conversation

@AungKoKoLin1997
Copy link
Contributor

@AungKoKoLin1997 AungKoKoLin1997 commented Sep 24, 2025

In Odoo 19, has_group() reads a cached _get_group_ids() (from all_group_ids), so inside a constraint right after changing group_ids it can be stale and return the wrong result.
So, I avoided using has_group() in a constraint.

Adding a read-only user to System Administrator from the Group form doesn't trigger the constraint method and the error is not raised at the moment.
Same limitation exists in Odoo 19 core.
odoo/odoo#228513

@qrtl QT5088

tslai and others added 20 commits September 24, 2025 09:06
Before this commit, button presentation of 'Grant Update Permit' and 'Readonly' were
broken in the user form with the deprecation of boolean_button widget.

In this commit, we switch to use boolean_toggle for these buttons, with some other style
adjustments on the buttons.
Currently translated at 100.0% (13 of 13 strings)

Translation: server-tools-15.0/server-tools-15.0-base_model_restrict_update
Translate-URL: https://translation.odoo-community.org/projects/server-tools-15-0/server-tools-15-0-base_model_restrict_update/es_AR/
…llow read-only exception models

Previously, the exemption for the model update restriction was given by
setting unrestrict_model_update to the relevant users. However, this
design had the limitation of not being able to control the permitted
users per model.

This commit addresses this limitation by adding the update_allowed_group_ids
field to ir.model, removing the unrestrict_model_update field from
res.users.

This commit also contains the following changes:

- Make the logic of _check_is_readonly_user() more complete.
- Refactor tests to make them more comprehensive.
- Add the flexibility of allowing certain models to be
  excluded from being read-only even when the user is set as read-only.
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 19.0-mig-base_model_restrict_update branch 3 times, most recently from 4006155 to 63d2e1f Compare September 26, 2025 01:23
@AungKoKoLin1997 AungKoKoLin1997 marked this pull request as ready for review September 26, 2025 03:17
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 19.0-mig-base_model_restrict_update branch from 63d2e1f to 77222b8 Compare September 29, 2025 01:17
@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 19.0-mig-base_model_restrict_update branch from 77222b8 to 6794b09 Compare November 18, 2025 07:11
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.

9 participants