diff --git a/rma/models/rma_order_line.py b/rma/models/rma_order_line.py
index f8b3ff6f..f9e03741 100644
--- a/rma/models/rma_order_line.py
+++ b/rma/models/rma_order_line.py
@@ -77,7 +77,10 @@ class RmaOrderLine(models.Model):
for move in self.move_ids:
first_usage = move._get_first_usage()
last_usage = move._get_last_usage()
- if first_usage in ("internal", "production") and last_usage != "internal":
+ if first_usage in ("internal", "production") and last_usage in (
+ "customer",
+ "supplier",
+ ):
pickings |= move.picking_id
elif last_usage == "customer" and first_usage == "supplier":
pickings |= move.picking_id
@@ -98,12 +101,24 @@ class RmaOrderLine(models.Model):
product_obj = self.env["uom.uom"]
qty = 0.0
if direction == "in":
- op = ops["="]
- else:
- op = ops["!="]
- for move in rec.move_ids.filtered(
- lambda m: m.state in states and op(m.location_id.usage, rec.type)
- ):
+ moves = rec.move_ids.filtered(
+ lambda m: m.state in states
+ and (
+ m.location_id.usage == "supplier"
+ or m.location_id.usage == "customer"
+ )
+ and m.location_dest_id.usage == "internal"
+ )
+ elif direction == "out":
+ moves = rec.move_ids.filtered(
+ lambda m: m.state in states
+ and (
+ m.location_dest_id.usage == "supplier"
+ or m.location_dest_id.usage == "customer"
+ )
+ and m.location_id.usage == "internal"
+ )
+ for move in moves:
# If the move is part of a chain don't count it
if direction == "out" and move.move_orig_ids:
continue
diff --git a/rma/views/rma_order_line_view.xml b/rma/views/rma_order_line_view.xml
index eff50667..e37ad287 100644
--- a/rma/views/rma_order_line_view.xml
+++ b/rma/views/rma_order_line_view.xml
@@ -387,7 +387,7 @@
@@ -457,7 +457,7 @@
Customer RMA
rma.order.line
[('type','=', 'customer')]
- {"search_default_assigned_to":uid}
+ {"search_default_assigned_to_filter":1}
tree,form
@@ -468,7 +468,7 @@
[('type','=', 'supplier')]
{"search_default_assigned_to":uid, "supplier":1}
+ >{"search_default_assigned_to_filter":1, "supplier":1}
tree,form
diff --git a/rma/views/stock_view.xml b/rma/views/stock_view.xml
index e2e80e67..cf7b0a4b 100644
--- a/rma/views/stock_view.xml
+++ b/rma/views/stock_view.xml
@@ -18,9 +18,9 @@
stock.route
-
+
+
diff --git a/rma/wizards/rma_make_picking_view.xml b/rma/wizards/rma_make_picking_view.xml
index d1902fdb..380be500 100644
--- a/rma/wizards/rma_make_picking_view.xml
+++ b/rma/wizards/rma_make_picking_view.xml
@@ -108,26 +108,26 @@
name="%(action_rma_picking_in)d"
string="Create Incoming Shipment"
class="oe_highlight"
- attrs="{'invisible':['|', '|', ('qty_to_receive', '=', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}"
+ attrs="{'invisible':['|', '|', '|', ('qty_to_receive', '=', 0), ('qty_to_receive', '<', 0), ('state', '!=', 'approved'), ('receipt_policy', '=', 'no')]}"
type="action"
/>