From 68860fcc9d5fc201017ca910577620e9d833c2c3 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Tue, 19 Mar 2019 10:30:34 +0000 Subject: [PATCH] [FIX] stock_dropshipping: modify SO - Create a SO with a dropship product, set a qty of 1.0 - Validate the SO - Validate the corresponding PO - Change the qty to the SO to 2.0 2 PO are created: the first one with a qty of 1.0, another with a qty of 3.0. There is an overlap of functionality between: - `_purchase_increase_ordered_qty` from `sale_purchase` (first PO) - `_action_launch_stock_rule` from `sale_stock` (second PO) The quantity is incorrectly computed since the quantity on the PO is taken into account only if the no stock move exist. We remove the latter condition, so the procurement quantity is computed correctly. opw-1950076 closes odoo/odoo#31963 Signed-off-by: Nicolas Martinelli (nim) --- addons/stock_dropshipping/models/sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock_dropshipping/models/sale.py b/addons/stock_dropshipping/models/sale.py index b527701a049..c942e5cdca1 100644 --- a/addons/stock_dropshipping/models/sale.py +++ b/addons/stock_dropshipping/models/sale.py @@ -13,7 +13,7 @@ class SaleOrderLine(models.Model): def _get_qty_procurement(self): # People without purchase rights should be able to do this operation purchase_lines_sudo = self.sudo().purchase_line_ids - if not self.move_ids.filtered(lambda r: r.state != 'cancel') and purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'): + if purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'): qty = 0.0 for po_line in purchase_lines_sudo.filtered(lambda r: r.state != 'cancel'): qty += po_line.product_uom._compute_quantity(po_line.product_qty, self.product_uom, rounding_method='HALF-UP')