[MIG]repair_refurbish v13

This commit is contained in:
ahenriquez
2020-03-19 13:34:18 +01:00
committed by Mateu Griful
parent 06d7f041ce
commit aa793f5aa4
4 changed files with 25 additions and 14 deletions

View File

@@ -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",

View File

@@ -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:

View File

@@ -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,

View File

@@ -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