[14.0][IMP] web_field_required_invisible_manager: FIX & IMP #3434
+113
−49
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
T19363 @BinhexTeam : Add Restriction Method (Whitelist/Blacklist) & Fix Context Bug
Problem: Currently, the module only operates on a "Blacklist" logic: if a user belongs to the selected groups, the restriction (invisible/readonly/required) is applied. It is difficult to achieve the opposite scenario: "Restrict this field for everyone, EXCEPT for this specific group" (Whitelist). For example, making a field Readonly for everyone except the "Sales Manager". To achieve this currently, one would need to select all other groups in the system, which is inefficient and hard to maintain.
Solution: This PR introduces a new configuration option restriction_method to the restriction rules:
Restrict these groups (Blacklist): Default behavior. The restriction applies if the user has one of the selected groups.
Restrict everyone EXCEPT these groups (Whitelist): New behavior. The restriction applies if the user does not have any of the selected groups.
Bug Fix: Fixed a ValidationError when creating rules from the "All Fields Restrictions" menu. Previously, the context caused required fields for different restriction types (Invisible/Readonly/Required) to conflict, preventing the creation of a rule if fields for other types were empty. The XML view attributes have been updated to handle the hide_title context correctly.