-
-
Notifications
You must be signed in to change notification settings - Fork 723
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] [ADD] stock_inventory_security #2189
base: 16.0
Are you sure you want to change the base?
[16.0] [ADD] stock_inventory_security #2189
Conversation
e635cd0
to
5383c1b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice and well tested, thanks @ivantodorovich
I suppose you are aware the Odoo standard use case is:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically LGTM, I just have a few questions
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, fixed!
@users("inventory", "admin") | ||
def test_inventory_user_lot_action(self): | ||
"""Test that the inventory user gets into inventory mode from lots""" | ||
res = self.product_lot.with_user(self.env.user).action_lot_open_quants() |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're essentially testing this:
https://github.com/odoo/odoo/blob/534220ee90da3e213ea99ec5da7ce6cc9eff4203/addons/stock/models/stock_quant.py#L400-L401
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've just realized that there were a copy/paste issue in my comment : my question was not about search_default_my_count
but about with_user(self.env.user)
-> So, when do you need the with_user
, when don't you ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The @users
decorator will set the user in self.env
.
However, recordsets that were already initialized during setUpClass
, referenced in variables like self.product_lot
, have their own env
set, which isn't modified by the decorator.
So, we need to set the user when interacting with them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okayy thank you for the explanation 👍
Hello @rousseldenis , Indeed. However here we need to grant non-manager users the ability to apply inventories |
5383c1b
to
093072f
Compare
This PR has the |
In standard, the inventory adjustments can only be applied by Inventory / Manager users.
This module introduces a new security group named Stock: Inventory Adjustments, which
grants regular stock users the ability to apply inventory adjustments.