From b2347b682133fbc3335adf151fa5f97b819ca492 Mon Sep 17 00:00:00 2001 From: jem-odoo Date: Wed, 22 Nov 2017 09:38:50 +0100 Subject: [PATCH] [IMP] sale_stock: expense policy should not impact delivered qty on SOL When making a SO with a stockable product with an expense policy set, confirming the SO will increase the delivered quantity according to the validated picking. But when unlocking and modifying the ordered quantity on picking the delivered quantity on SO does not change (it is if the product have no expense policy). So the expense policy influence the flow in a way (update validated picking) but not on the the other (confirm SO) to compute SO line delivered quantity. This commits make the expense policy not relevent when modifying ordered quantity on picking. It also prepare the cleaning to unify API of delivered quantity computation on SO line for stock and service. --- addons/sale_stock/models/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale_stock/models/stock.py b/addons/sale_stock/models/stock.py index 200622f8e31..8ec7ced7756 100644 --- a/addons/sale_stock/models/stock.py +++ b/addons/sale_stock/models/stock.py @@ -38,7 +38,7 @@ class StockMove(models.Model): if 'product_uom_qty' in vals: for move in self: if move.state == 'done': - sale_order_lines = self.filtered(lambda move: move.sale_line_id and move.product_id.expense_policy == 'no').mapped('sale_line_id') + sale_order_lines = self.filtered(lambda move: move.sale_line_id).mapped('sale_line_id') for line in sale_order_lines: line.qty_delivered = line._get_delivered_qty() return res