diff --git a/repair_refurbish/__manifest__.py b/repair_refurbish/__manifest__.py index e24b4d64d..a4bbca82b 100644 --- a/repair_refurbish/__manifest__.py +++ b/repair_refurbish/__manifest__.py @@ -3,13 +3,13 @@ { "name": "MRP Repair Refurbish", "summary": "Create refurbished products during repair", - "version": "12.0.1.1.3", + "version": "13.0.1.0.0", "category": "Manufacturing", "website": "https://github.com/OCA/manufacture", "author": "ForgeFlow S.L., Odoo Community Association (OCA)", "license": "AGPL-3", "installable": True, - "depends": ["repair",], + "depends": ["repair"], "data": [ "views/repair_view.xml", "data/stock_data.xml", diff --git a/repair_refurbish/models/product_template.py b/repair_refurbish/models/product_template.py index 12fedd3ee..3dad0da48 100644 --- a/repair_refurbish/models/product_template.py +++ b/repair_refurbish/models/product_template.py @@ -37,7 +37,6 @@ class ProductTemplate(models.Model): template.product_variant_ids.refurbish_product_id ) - @api.multi def _inverse_refurbish_product(self): for rec in self: if len(rec.product_variant_ids) == 1: diff --git a/repair_refurbish/models/repair.py b/repair_refurbish/models/repair.py index 0729198f4..ffd04a66a 100644 --- a/repair_refurbish/models/repair.py +++ b/repair_refurbish/models/repair.py @@ -41,7 +41,6 @@ class RepairOrder(models.Model): self.refurbish_product_id = False self.refurbish_location_dest_id = False - @api.multi def _get_refurbish_stock_move_dict(self): return { "name": self.name, @@ -71,7 +70,6 @@ class RepairOrder(models.Model): ], } - @api.multi def action_repair_done(self): res = super( RepairOrder, diff --git a/repair_refurbish/tests/test_repair_refurbish.py b/repair_refurbish/tests/test_repair_refurbish.py index 18437a5a2..8e63894b5 100644 --- a/repair_refurbish/tests/test_repair_refurbish.py +++ b/repair_refurbish/tests/test_repair_refurbish.py @@ -17,7 +17,7 @@ class TestMrpMtoWithStock(TransactionCase): self.refurbish_loc = self.env.ref("repair_refurbish.stock_location_refurbish") self.refurbish_product = self.product_obj.create( - {"name": "Refurbished Awesome Screen", "type": "product",} + {"name": "Refurbished Awesome Screen", "type": "product"} ) self.product = self.product_obj.create( { @@ -26,22 +26,36 @@ class TestMrpMtoWithStock(TransactionCase): "refurbish_product_id": self.refurbish_product.id, } ) - self.material = self.product_obj.create({"name": "Materials", "type": "consu",}) + self.material = self.product_obj.create({"name": "Materials", "type": "consu"}) self.material2 = self.product_obj.create( - {"name": "Materials", "type": "product",} + {"name": "Materials", "type": "product"} ) self._update_product_qty(self.product, self.stock_location_stock, 10.0) def _update_product_qty(self, product, location, quantity): - product_qty = self.env["stock.change.product.qty"].create( + inventory = self.env["stock.inventory"].create( { - "location_id": location.id, - "product_id": product.id, - "new_quantity": quantity, + "name": "Test Inventory", + "product_ids": [(6, 0, product.ids)], + "state": "confirm", + "line_ids": [ + ( + 0, + 0, + { + "product_qty": quantity, + "location_id": location.id, + "product_id": product.id, + "product_uom_id": product.uom_id.id, + }, + ) + ], } ) - product_qty.change_product_qty() - return product_qty + inventory.action_start() + inventory.line_ids[0].write({"product_qty": quantity}) + inventory.action_validate() + return quantity def test_01_repair_refurbish(self): """Tests that locations are properly set with a product to