Skip to content
Permalink
Browse files

[FIX] stock_dropshipping: do not merge PO lines coming from a SO

Fine tuning of commit b9e3c15, for the same use-case.
The route may not be passed in values, in which case the bug is still present.
There are two ways to go around that.
We could add the stock.rule in values, which contains the route.
The solution we adopt here is to use the sale_line_id field on the purchase line
If it is present, it was added through _prepare_purchase_order_line,
and thus we want to keep track of the origin.

opw 1957701
  • Loading branch information...
len-odoo committed Apr 15, 2019
1 parent 330e1ea commit dc62d5c08b34fec61c9b0092a9322bc9a7513d77
Showing with 3 additions and 1 deletion.
  1. +3 −1 addons/stock_dropshipping/models/purchase.py
@@ -17,7 +17,9 @@ def _prepare_stock_moves(self, picking):
return res

def _merge_in_existing_line(self, product_id, product_qty, product_uom, location_id, name, origin, values):
if values.get('route_ids') and values['route_ids'] == self.env.ref('stock_dropshipping.route_drop_shipping'):
if self.sale_line_id:
# if this is defined, this is a dropshipping line, so no
# this is to correctly map delivered quantities to the so lines
return False
return super(PurchaseOrderLine, self)._merge_in_existing_line(
product_id=product_id, product_qty=product_qty, product_uom=product_uom,

0 comments on commit dc62d5c

Please sign in to comment.
You can’t perform that action at this time.