Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][FIX] stock_lock_lot fix: fixed permissions issue when creating product categories #1832

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

FLAlvaroGomez
Copy link

@FLAlvaroGomez FLAlvaroGomez commented Jan 16, 2025

Fix permissions validation when changing 'lot_default_locked' field

The permission checks for modifying the lot_default_locked field has been improved. Now, the system compares the current value of lot_default_locked with the new value being set and ensures the user has the necessary permissions (stock_lock_lot.group_lock_lot) before allowing the change. This prevents unauthorized users from blocking or unblocking serial numbers/lots.

@FLAlvaroGomez FLAlvaroGomez changed the title [16.0][FIX] stock_lock_lot_ fix: fix permissions issue when creating product categories [16.0][FIX] stock_lock_lot_ fix: fixed permissions issue when creating product categories Jan 20, 2025
def _check_category_lock_unlock(self):
if not self.user_has_groups("stock_lock_lot.group_lock_lot"):
def _check_category_lock_unlock(self, vals):
if self.lot_default_locked != vals and not self.user_has_groups(
Copy link
Contributor

Choose a reason for hiding this comment

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

@FLAlvaroGomez My question here: why is the constrains() trigger if the value hasn't changed ?

Copy link
Author

@FLAlvaroGomez FLAlvaroGomez Jan 21, 2025

Choose a reason for hiding this comment

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

@rousseldenis Updated, now the write method checks if the attribute changes to avoid executing the _check_category_lock_unlock method unnecessarily

Copy link
Contributor

Choose a reason for hiding this comment

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

@rousseldenis can see the error in the video made in runbot.

Runboat-builds.webm

@FLAlvaroGomez FLAlvaroGomez force-pushed the 16.0-fix-stock_lock_lot branch from 39687f0 to c84b8a5 Compare January 21, 2025 10:02
@FLAlvaroGomez FLAlvaroGomez changed the title [16.0][FIX] stock_lock_lot_ fix: fixed permissions issue when creating product categories [16.0][FIX] stock_lock_lot fix: fixed permissions issue when creating product categories Jan 22, 2025
Fix permissions issue when creating product categories
@FLAlvaroGomez FLAlvaroGomez force-pushed the 16.0-fix-stock_lock_lot branch from f9d4caa to 35ea60c Compare January 22, 2025 11:02
@FLAlvaroGomez FLAlvaroGomez marked this pull request as ready for review January 22, 2025 11:03
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.

3 participants