summaryrefslogtreecommitdiff
path: root/addons/mrp/tests/test_workorder_operation.py
diff options
context:
space:
mode:
authorsvs-odoo <svs@odoo.com>2019-05-03 08:02:16 +0000
committersvs-odoo <svs@odoo.com>2019-05-29 13:59:01 +0000
commitda33eb36b80d1b2a0004c28cf20d6b0263bcb643 (patch)
treee3a93c2ab2bac21dc43401013af28f491429d1a8 /addons/mrp/tests/test_workorder_operation.py
parentbe2795513644f09f6b443f462bb67cc5a0762e8d (diff)
[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: sle-odoo <sle@odoo.com>
Diffstat (limited to 'addons/mrp/tests/test_workorder_operation.py')
-rw-r--r--addons/mrp/tests/test_workorder_operation.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/mrp/tests/test_workorder_operation.py b/addons/mrp/tests/test_workorder_operation.py
index 38d52c799c2..530abcab062 100644
--- a/addons/mrp/tests/test_workorder_operation.py
+++ b/addons/mrp/tests/test_workorder_operation.py
@@ -307,11 +307,11 @@ class TestWorkOrderProcess(TestMrpCommon):
man_order = man_order_form.save()
# reset quantities
self.product_1.type = "product"
- self.env['stock.change.product.qty'].create({
+ self.env['stock.quant'].with_context(inventory_mode=True).create({
'product_id': self.product_1.id,
- 'new_quantity': 0.0,
+ 'inventory_quantity': 0.0,
'location_id': self.warehouse_1.lot_stock_id.id,
- }).change_product_qty()
+ })
(self.product_2 | self.product_4).write({
'tracking': 'none',