mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[repair_refurbish][fix] Change destination location
This commit is contained in:
@@ -103,8 +103,16 @@ class RepairLine(models.Model):
|
||||
and "to_refurbish" in context
|
||||
and not context["to_refurbish"]
|
||||
):
|
||||
scrap_location_id = self.env["stock.location"].search(
|
||||
[("usage", "=", "customer")], limit=1
|
||||
scrap_location_id = (
|
||||
self.env["stock.location"]
|
||||
.search(
|
||||
[
|
||||
("scrap_location", "=", True),
|
||||
("company_id", "in", [self.repair_id.company_id.id, False]),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
.id
|
||||
)
|
||||
self.location_dest_id = scrap_location_id
|
||||
return res
|
||||
|
||||
@@ -14,6 +14,9 @@ class TestMrpMtoWithStock(TransactionCase):
|
||||
|
||||
self.stock_location_stock = self.env.ref("stock.stock_location_stock")
|
||||
self.customer_location = self.env.ref("stock.stock_location_customers")
|
||||
self.scrap_location = self.env["stock.location"].search(
|
||||
[("scrap_location", "=", True)], limit=1
|
||||
)
|
||||
self.refurbish_loc = self.env.ref("repair_refurbish.stock_location_refurbish")
|
||||
|
||||
self.refurbish_product = self.product_obj.create(
|
||||
@@ -159,4 +162,4 @@ class TestMrpMtoWithStock(TransactionCase):
|
||||
move = self.move_obj.search(
|
||||
[("product_id", "=", self.material2.id)], order="create_date desc", limit=1
|
||||
)[0]
|
||||
self.assertEqual(move.location_dest_id, self.customer_location)
|
||||
self.assertEqual(move.location_dest_id, self.scrap_location)
|
||||
|
||||
Reference in New Issue
Block a user