From e90842aba2a35a3b75a0ded8b4f80eee65cb5bbc Mon Sep 17 00:00:00 2001 From: sergiocorato Date: Wed, 10 Jul 2024 12:28:59 +0200 Subject: [PATCH] [12.0][FIX] purchase_open_qty refund from dropship --- purchase_open_qty/models/purchase_order.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/purchase_open_qty/models/purchase_order.py b/purchase_open_qty/models/purchase_order.py index 23e2b5efa67..3076511c023 100644 --- a/purchase_open_qty/models/purchase_order.py +++ b/purchase_open_qty/models/purchase_order.py @@ -41,8 +41,13 @@ def _compute_qty_to_receive(self): lambda m: m.state == 'done'): sign = 1 # in case of outgoing (refund) sign is inverted - if move.location_id.usage == 'internal' and \ - move.location_dest_id.usage != 'internal': + # also support particular case of refund from a supplier dropship + if ( + move.location_id.usage == 'internal' + and move.location_dest_id.usage != 'internal' + or move.location_id.usage == 'customer' + and move.location_dest_id.usage == 'supplier' + ): sign = -1 product_uom_qty = move.product_uom_qty * sign if move.product_uom != line.product_uom: