From e542b450a34d5c3723c92cb95d7132a288c46e60 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 16 Mar 2017 13:15:46 +0100 Subject: [PATCH] [FIX] sale_stock: duplicate qty - Create a stockable product, create a SO selling 1 unit. - Confirm the SO, validate the Picking 1 => delivered qty is 1 - Return Picking 1 and validate Picking 2 => delivered qty is 1 - Return Picking 2 and validate Picking 3 => delivered qty is 2 The delivered quantity should remain 1. opw-715685 --- addons/sale_stock/sale_stock.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py index 63f03f4a64f..2f817e09978 100644 --- a/addons/sale_stock/sale_stock.py +++ b/addons/sale_stock/sale_stock.py @@ -197,7 +197,8 @@ class SaleOrderLine(models.Model): #Note that we don't decrease quantity for customer returns on purpose: these are exeptions that must be treated manually. Indeed, #modifying automatically the delivered quantity may trigger an automatic reinvoicing (refund) of the SO, which is definitively not wanted if move.location_dest_id.usage == "customer": - qty += self.env['product.uom']._compute_qty_obj(move.product_uom, move.product_uom_qty, self.product_uom) + if not move.origin_returned_move_id: + qty += self.env['product.uom']._compute_qty_obj(move.product_uom, move.product_uom_qty, self.product_uom) return qty @api.multi