diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index f8a388b3b..44e222b93 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -596,7 +596,6 @@ def _prepare_rma_line_from_stock_move(self, sm, lot=False): operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id or operation.out_warehouse_id.lot_rma_id.id - or warehouse.lot_rma_id.id ), } return data diff --git a/rma/models/stock_warehouse.py b/rma/models/stock_warehouse.py index 26bacffb3..d0318a738 100644 --- a/rma/models/stock_warehouse.py +++ b/rma/models/stock_warehouse.py @@ -29,11 +29,11 @@ class StockWarehouse(models.Model): "for this warehouse.", ) rma_customer_pull_id = fields.Many2one( - comodel_name="stock.location.route", + comodel_name="stock.route", string="RMA Customer Route", ) rma_supplier_pull_id = fields.Many2one( - comodel_name="stock.location.route", + comodel_name="stock.route", string="RMA Supplier Route", ) @@ -196,7 +196,7 @@ def get_rma_route_customer(self): "warehouse_id": self.id, "company_id": self.company_id.id, "location_src_id": customer_loc.id, - "location_id": self.lot_rma_id.id, + "location_dest_id": self.lot_rma_id.id, "procure_method": "make_to_stock", "picking_type_id": self.rma_cust_in_type_id.id, "active": True, @@ -213,7 +213,7 @@ def get_rma_route_customer(self): "warehouse_id": self.id, "company_id": self.company_id.id, "location_src_id": self.lot_rma_id.id, - "location_id": customer_loc.id, + "location_dest_id": customer_loc.id, "procure_method": "make_to_stock", "picking_type_id": self.rma_cust_out_type_id.id, "active": True, @@ -243,7 +243,7 @@ def get_rma_route_supplier(self): "warehouse_id": self.id, "company_id": self.company_id.id, "location_src_id": supplier_loc.id, - "location_id": self.lot_rma_id.id, + "location_dest_id": self.lot_rma_id.id, "procure_method": "make_to_stock", "picking_type_id": self.rma_sup_in_type_id.id, "active": True, @@ -260,7 +260,7 @@ def get_rma_route_supplier(self): "warehouse_id": self.id, "company_id": self.company_id.id, "location_src_id": self.lot_rma_id.id, - "location_id": supplier_loc.id, + "location_dest_id": supplier_loc.id, "procure_method": "make_to_stock", "picking_type_id": self.rma_sup_out_type_id.id, "active": True, @@ -272,7 +272,7 @@ def get_rma_route_supplier(self): return rma_route def _create_rma_pull(self): - route_obj = self.env["stock.location.route"] + route_obj = self.env["stock.route"] for wh in self: if not wh.rma_customer_pull_id: wh.rma_customer_pull_id = ( diff --git a/rma/tests/test_rma.py b/rma/tests/test_rma.py index aea7f55d9..385277cd9 100644 --- a/rma/tests/test_rma.py +++ b/rma/tests/test_rma.py @@ -1083,9 +1083,9 @@ def test_08_customer_rma_multi_step(self): self.wh.reception_steps = "two_steps" self.wh.delivery_steps = "pick_ship" cust_in_pull_rule = self.customer_route.rule_ids.filtered( - lambda r: r.location_id == self.stock_rma_location + lambda r: r.location_dest_id == self.stock_rma_location ) - cust_in_pull_rule.location_id = self.input_location + cust_in_pull_rule.location_dest_id = self.input_location cust_out_pull_rule = self.customer_route.rule_ids.filtered( lambda r: r.location_src_id == self.env.ref("rma.location_rma") ) @@ -1097,7 +1097,7 @@ def test_08_customer_rma_multi_step(self): "action": "pull", "warehouse_id": self.wh.id, "location_src_id": self.wh.lot_rma_id.id, - "location_id": self.output_location.id, + "location_dest_id": self.output_location.id, "procure_method": "make_to_stock", "route_id": self.customer_route.id, "picking_type_id": self.env.ref("stock.picking_type_internal").id, @@ -1109,7 +1109,7 @@ def test_08_customer_rma_multi_step(self): "action": "pull", "warehouse_id": self.wh.id, "location_src_id": self.output_location.id, - "location_id": self.customer_location.id, + "location_dest_id": self.customer_location.id, "procure_method": "make_to_order", "route_id": self.customer_route.id, "picking_type_id": self.env.ref("stock.picking_type_internal").id, @@ -1121,7 +1121,7 @@ def test_08_customer_rma_multi_step(self): "action": "pull", "warehouse_id": self.wh.id, "location_src_id": self.customer_location.id, - "location_id": self.input_location.id, + "location_dest_id": self.input_location.id, "procure_method": "make_to_stock", "route_id": self.customer_route.id, "picking_type_id": self.env.ref("stock.picking_type_internal").id, @@ -1133,7 +1133,7 @@ def test_08_customer_rma_multi_step(self): "action": "pull", "warehouse_id": self.wh.id, "location_src_id": self.input_location.id, - "location_id": self.wh.lot_rma_id.id, + "location_dest_id": self.wh.lot_rma_id.id, "procure_method": "make_to_order", "route_id": self.customer_route.id, "picking_type_id": self.env.ref("stock.picking_type_internal").id, diff --git a/rma/views/stock_warehouse.xml b/rma/views/stock_warehouse.xml index 8a63900cd..8d8c892c0 100644 --- a/rma/views/stock_warehouse.xml +++ b/rma/views/stock_warehouse.xml @@ -7,14 +7,11 @@ - - + + - - - diff --git a/rma_account/models/rma_order_line.py b/rma_account/models/rma_order_line.py index 74bca60d7..227673d70 100644 --- a/rma_account/models/rma_order_line.py +++ b/rma_account/models/rma_order_line.py @@ -183,7 +183,7 @@ def _prepare_rma_line_from_inv_line(self, line): raise ValidationError(_("Please define an operation first")) if not operation.in_route_id or not operation.out_route_id: - route = self.env["stock.location.route"].search( + route = self.env["stock.route"].search( [("rma_selectable", "=", True)], limit=1 ) if not route: @@ -222,9 +222,7 @@ def _prepare_rma_line_from_inv_line(self, line): "in_route_id": operation.in_route_id.id or route.id, "out_route_id": operation.out_route_id.id or route.id, "location_id": ( - operation.location_id.id - or operation.in_warehouse_id.lot_rma_id.id - or warehouse.lot_rma_id.id + operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id ), } return data diff --git a/rma_account/tests/test_rma_stock_account.py b/rma_account/tests/test_rma_stock_account.py index 3889c2a2d..c1263c1db 100644 --- a/rma_account/tests/test_rma_stock_account.py +++ b/rma_account/tests/test_rma_stock_account.py @@ -283,7 +283,7 @@ def test_08_cost_from_move_multi_step(self): "action": "pull", "warehouse_id": self.wh.id, "location_src_id": self.output_location.id, - "location_id": self.customer_location.id, + "location_dest_id": self.customer_location.id, "procure_method": "make_to_order", "route_id": self.customer_route.id, "picking_type_id": self.env.ref("stock.picking_type_internal").id, @@ -295,7 +295,7 @@ def test_08_cost_from_move_multi_step(self): "action": "pull", "warehouse_id": self.wh.id, "location_src_id": self.customer_location.id, - "location_id": self.input_location.id, + "location_dest_id": self.input_location.id, "procure_method": "make_to_stock", "route_id": self.customer_route.id, "picking_type_id": self.env.ref("stock.picking_type_internal").id, diff --git a/rma_account/wizards/rma_add_account_move.py b/rma_account/wizards/rma_add_account_move.py index d4588f11c..519e2238f 100644 --- a/rma_account/wizards/rma_add_account_move.py +++ b/rma_account/wizards/rma_add_account_move.py @@ -56,7 +56,7 @@ def _prepare_rma_line_from_inv_line(self, line): if not operation: raise ValidationError(_("Please define an operation first")) if not operation.in_route_id or not operation.out_route_id: - route = self.env["stock.location.route"].search( + route = self.env["stock.route"].search( [("rma_selectable", "=", True)], limit=1 ) if not route: @@ -100,9 +100,7 @@ def _prepare_rma_line_from_inv_line(self, line): "in_route_id": operation.in_route_id.id or route.id, "out_route_id": operation.out_route_id.id or route.id, "location_id": ( - operation.location_id.id - or operation.in_warehouse_id.lot_rma_id.id - or warehouse.lot_rma_id.id + operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id ), } return data diff --git a/rma_purchase/models/rma_order_line.py b/rma_purchase/models/rma_order_line.py index a2e1aea4f..03c3cc48e 100644 --- a/rma_purchase/models/rma_order_line.py +++ b/rma_purchase/models/rma_order_line.py @@ -134,7 +134,7 @@ def _prepare_rma_line_from_po_line(self, line): raise ValidationError(_("Please define an operation first")) if not operation.in_route_id or not operation.out_route_id: - route = self.env["stock.location.route"].search( + route = self.env["stock.route"].search( [("rma_selectable", "=", True)], limit=1 ) if not route: @@ -168,9 +168,7 @@ def _prepare_rma_line_from_po_line(self, line): "receipt_policy": operation.receipt_policy, "currency_id": line.currency_id.id, "location_id": ( - operation.location_id.id - or operation.in_warehouse_id.lot_rma_id.id - or warehouse.lot_rma_id.id + operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id ), "refund_policy": operation.refund_policy, "delivery_policy": operation.delivery_policy, diff --git a/rma_purchase/wizards/rma_add_purchase.py b/rma_purchase/wizards/rma_add_purchase.py index 26aed30a7..f54f6d8cb 100644 --- a/rma_purchase/wizards/rma_add_purchase.py +++ b/rma_purchase/wizards/rma_add_purchase.py @@ -59,7 +59,7 @@ def _prepare_rma_line_from_po_line(self, line): if not operation: raise ValidationError(_("Please define an operation first")) if not operation.in_route_id or not operation.out_route_id: - route = self.env["stock.location.route"].search( + route = self.env["stock.route"].search( [("rma_selectable", "=", True)], limit=1 ) if not route: @@ -97,9 +97,7 @@ def _prepare_rma_line_from_po_line(self, line): "out_route_id": operation.out_route_id.id or route, "receipt_policy": operation.receipt_policy, "location_id": ( - operation.location_id.id - or operation.in_warehouse_id.lot_rma_id.id - or warehouse.lot_rma_id.id + operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id ), "refund_policy": operation.refund_policy, "delivery_policy": operation.delivery_policy, diff --git a/rma_sale/models/rma_order_line.py b/rma_sale/models/rma_order_line.py index 4f722a08b..a15b103f6 100644 --- a/rma_sale/models/rma_order_line.py +++ b/rma_sale/models/rma_order_line.py @@ -119,7 +119,7 @@ def _prepare_rma_line_from_sale_order_line(self, line): if not operation: raise ValidationError(_("Please define an operation first")) if not operation.in_route_id or not operation.out_route_id: - route = self.env["stock.location.route"].search( + route = self.env["stock.route"].search( [("rma_selectable", "=", True)], limit=1 ) if not route: @@ -153,9 +153,7 @@ def _prepare_rma_line_from_sale_order_line(self, line): "receipt_policy": operation.receipt_policy, "currency_id": line.currency_id.id, "location_id": ( - operation.location_id.id - or operation.in_warehouse_id.lot_rma_id.id - or warehouse.lot_rma_id.id + operation.location_id.id or operation.in_warehouse_id.lot_rma_id.id ), "refund_policy": operation.refund_policy, "delivery_policy": operation.delivery_policy, diff --git a/rma_sale/wizards/rma_add_sale.py b/rma_sale/wizards/rma_add_sale.py index 1adcd1f57..9a4a34998 100644 --- a/rma_sale/wizards/rma_add_sale.py +++ b/rma_sale/wizards/rma_add_sale.py @@ -95,7 +95,7 @@ def _prepare_rma_line_from_sale_order_line(self, line, lot=None): if not operation: raise ValidationError(_("Please define an operation first")) if not operation.in_route_id or not operation.out_route_id: - route = self.env["stock.location.route"].search( + route = self.env["stock.route"].search( [("rma_selectable", "=", True)], limit=1 ) if not route: