mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[MIG]repair_refurbish v13
This commit is contained in:
@@ -3,13 +3,13 @@
|
|||||||
{
|
{
|
||||||
"name": "MRP Repair Refurbish",
|
"name": "MRP Repair Refurbish",
|
||||||
"summary": "Create refurbished products during repair",
|
"summary": "Create refurbished products during repair",
|
||||||
"version": "12.0.1.1.3",
|
"version": "13.0.1.0.0",
|
||||||
"category": "Manufacturing",
|
"category": "Manufacturing",
|
||||||
"website": "https://github.com/OCA/manufacture",
|
"website": "https://github.com/OCA/manufacture",
|
||||||
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
|
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"installable": True,
|
"installable": True,
|
||||||
"depends": ["repair",],
|
"depends": ["repair"],
|
||||||
"data": [
|
"data": [
|
||||||
"views/repair_view.xml",
|
"views/repair_view.xml",
|
||||||
"data/stock_data.xml",
|
"data/stock_data.xml",
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ class ProductTemplate(models.Model):
|
|||||||
template.product_variant_ids.refurbish_product_id
|
template.product_variant_ids.refurbish_product_id
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _inverse_refurbish_product(self):
|
def _inverse_refurbish_product(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if len(rec.product_variant_ids) == 1:
|
if len(rec.product_variant_ids) == 1:
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ class RepairOrder(models.Model):
|
|||||||
self.refurbish_product_id = False
|
self.refurbish_product_id = False
|
||||||
self.refurbish_location_dest_id = False
|
self.refurbish_location_dest_id = False
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def _get_refurbish_stock_move_dict(self):
|
def _get_refurbish_stock_move_dict(self):
|
||||||
return {
|
return {
|
||||||
"name": self.name,
|
"name": self.name,
|
||||||
@@ -71,7 +70,6 @@ class RepairOrder(models.Model):
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def action_repair_done(self):
|
def action_repair_done(self):
|
||||||
res = super(
|
res = super(
|
||||||
RepairOrder,
|
RepairOrder,
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class TestMrpMtoWithStock(TransactionCase):
|
|||||||
self.refurbish_loc = self.env.ref("repair_refurbish.stock_location_refurbish")
|
self.refurbish_loc = self.env.ref("repair_refurbish.stock_location_refurbish")
|
||||||
|
|
||||||
self.refurbish_product = self.product_obj.create(
|
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(
|
self.product = self.product_obj.create(
|
||||||
{
|
{
|
||||||
@@ -26,22 +26,36 @@ class TestMrpMtoWithStock(TransactionCase):
|
|||||||
"refurbish_product_id": self.refurbish_product.id,
|
"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(
|
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)
|
self._update_product_qty(self.product, self.stock_location_stock, 10.0)
|
||||||
|
|
||||||
def _update_product_qty(self, product, location, quantity):
|
def _update_product_qty(self, product, location, quantity):
|
||||||
product_qty = self.env["stock.change.product.qty"].create(
|
inventory = self.env["stock.inventory"].create(
|
||||||
{
|
{
|
||||||
|
"name": "Test Inventory",
|
||||||
|
"product_ids": [(6, 0, product.ids)],
|
||||||
|
"state": "confirm",
|
||||||
|
"line_ids": [
|
||||||
|
(
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
"product_qty": quantity,
|
||||||
"location_id": location.id,
|
"location_id": location.id,
|
||||||
"product_id": product.id,
|
"product_id": product.id,
|
||||||
"new_quantity": quantity,
|
"product_uom_id": product.uom_id.id,
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
product_qty.change_product_qty()
|
inventory.action_start()
|
||||||
return product_qty
|
inventory.line_ids[0].write({"product_qty": quantity})
|
||||||
|
inventory.action_validate()
|
||||||
|
return quantity
|
||||||
|
|
||||||
def test_01_repair_refurbish(self):
|
def test_01_repair_refurbish(self):
|
||||||
"""Tests that locations are properly set with a product to
|
"""Tests that locations are properly set with a product to
|
||||||
|
|||||||
Reference in New Issue
Block a user