From ce3faa653ef16c85d5a5bb12c56d88a86dc63f97 Mon Sep 17 00:00:00 2001 From: Raphael Lee <51208020+RLeeOSI@users.noreply.github.com> Date: Wed, 17 Mar 2021 14:45:57 -0700 Subject: [PATCH] [14.0][FIX] warehouse rma location --- rma/models/rma_order_line.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py index 3d7f987f..cdc3d41f 100644 --- a/rma/models/rma_order_line.py +++ b/rma/models/rma_order_line.py @@ -498,14 +498,21 @@ class RmaOrderLine(models.Model): if not route: raise ValidationError(_("Please define an RMA route.")) - if not operation.in_warehouse_id or not operation.out_warehouse_id: + if ( + not operation.in_warehouse_id + or not operation.out_warehouse_id + or not ( + operation.in_warehouse_id.lot_rma_id + or operation.out_warehouse_id.lot_rma_id + ) + ): warehouse = self.env["stock.warehouse"].search( [("company_id", "=", self.company_id.id), ("lot_rma_id", "!=", False)], limit=1, ) if not warehouse: raise ValidationError( - _("Please define a warehouse with a default RMA " "location.") + _("Please define a warehouse with a default RMA location.") ) data = { @@ -525,6 +532,7 @@ class RmaOrderLine(models.Model): "location_id": ( 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 ), }