[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 <amoyaux@users.noreply.github.com>
This commit is contained in:
Uku Lagle
2020-09-16 16:59:19 +00:00
parent 68ca2f677e
commit 6888c2a8de
+1 -1
View File
@@ -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()