From 6888c2a8de57fb2405a4fe2a01e650f43900c5c2 Mon Sep 17 00:00:00 2001 From: Uku Lagle Date: Fri, 4 Sep 2020 15:15:29 +0000 Subject: [PATCH] [FIX] purchase_stock: update picking on qty change if dropship The original feature was introduced in commit #8248f0e153a and works well for internal transfers, but fails for dropship. For latter, if quantity is changed on confirmed PO line, new picking is created, even if the quantity was decreased not increased, leaving the new draft picking empty. closes odoo/odoo#57893 X-original-commit: 77a96b2dd0fab4c6b6136d0f23422d8a2bc68bca Signed-off-by: Arnold Moyaux --- addons/purchase_stock/models/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index 2916e1b3853..1600ec640ae 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -368,7 +368,7 @@ class PurchaseOrderLine(models.Model): note=_('The quantities on your purchase order indicate less than billed. You should ask for a refund.')) # If the user increased quantity of existing line or created a new line - pickings = line.order_id.picking_ids.filtered(lambda x: x.state not in ('done', 'cancel') and x.location_dest_id.usage in ('internal', 'transit')) + pickings = line.order_id.picking_ids.filtered(lambda x: x.state not in ('done', 'cancel') and x.location_dest_id.usage in ('internal', 'transit', 'customer')) picking = pickings and pickings[0] or False if not picking: res = line.order_id._prepare_picking()