Skip to content
Snippets Groups Projects
Commit da33eb36 authored by svs-odoo's avatar svs-odoo
Browse files

[IMP] stock: editable quants


Made some changes in stock.quant model to allow user to modify product
quantity easier.

To allow the edition of quant without opening more permissions on the
model, we switch to sudo in create mode and write if the conditions are
met (special key in context + access rights on the current user + write
on a specific field).
Also, we have two list views for the quant:
    - The old list view who still readonly.
    - A new list view where user can create new quant or edit quantity
    of existing ones

We display the second one if user is a stock manager.
For existing quants, user can modify counted quantity (which will modify
product quantity). User can also create new quant, in this case:
    - The quant is really a new one (ex.: new product/location
    association) so will simply create a new quant.
    - A corresponding quant already exist, so will modify the existing
    quant instead of create a new one.

When an user creates a new quant, the model will check each time a
non-quantity field (product, location, SN/LN, package or owner) is
modified to see if corresponding quant exists. In this case, it'll get
the quant ID and will update reserved and on hand quantities.
If user didn't change the inventory quantity, it'll be updated too.

On product form view, the 'Update quantity' button was removed as user
can now simply modify quant with 'On Hand' stat button.

Task #1935921

Co-authored-by: default avatarsle-odoo <sle@odoo.com>
parent be279551
Branches
Tags
No related merge requests found
Showing
with 545 additions and 243 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment