summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Lejeune <sle@openerp.com>2018-10-12 09:00:24 +0200
committerNicolas Martinelli <nim-odoo@users.noreply.github.com>2018-10-12 10:21:14 +0200
commit0b414cb8145381cd8a3946aae9cec1601b111238 (patch)
tree698cd9400f9627a4414e694e423bf390310cc0c9
parent3df584f5a68ec61a719dc34b59028e9a4c230edf (diff)
[FIX] sale_stock: return of return and delivered quantity
The code ignored return of return when computing the delivered quantity of a so line (in this part of the code, if a move has a destination location set a customer, it'd be a return of return of a delivery). We now update the delivered quantity is the return of return as the `to_refund` flag enabled, meaning the user ticked the option to update the quantity on the so line. opw-1884683
-rw-r--r--addons/sale_stock/models/sale_order.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/sale_stock/models/sale_order.py b/addons/sale_stock/models/sale_order.py
index 64d4398cba1..b87ead381f0 100644
--- a/addons/sale_stock/models/sale_order.py
+++ b/addons/sale_stock/models/sale_order.py
@@ -181,7 +181,8 @@ class SaleOrderLine(models.Model):
qty = 0.0
for move in self.procurement_ids.mapped('move_ids').filtered(lambda r: r.state == 'done' and not r.scrapped):
if move.location_dest_id.usage == "customer":
- if not move.origin_returned_move_id:
+ # FORWARD-PORT NOTICE: "to_refund_so" to rename to "to_refund" in v11
+ if not move.origin_returned_move_id or (move.origin_returned_move_id and move.to_refund_so):
qty += move.product_uom._compute_quantity(move.product_uom_qty, self.product_uom)
elif move.location_dest_id.usage != "customer" and move.to_refund_so:
qty -= move.product_uom._compute_quantity(move.product_uom_qty, self.product_uom)