Skip to content
Permalink
Browse files

[FIX] stock: multiple orderpoint

- the oderpoint_id field on the purchase order line wasn't used to not
  merge the po lines
- if the orderpoint_id field is set, use the orderpoint location

task-2001462
  • Loading branch information
sle-odoo committed Nov 19, 2019
1 parent 9b3de32 commit 3976a79fea9fae06ced25384bbdc0d733a5628ef
Showing with 2 additions and 2 deletions.
  1. +2 −2 addons/purchase_stock/models/purchase.py
@@ -360,7 +360,7 @@ def _prepare_stock_moves(self, picking):
'date': self.order_id.date_order,
'date_expected': self.date_planned,
'location_id': self.order_id.partner_id.property_stock_supplier.id,
'location_dest_id': self.order_id._get_destination_location(),
'location_dest_id': self.orderpoint_id and self.orderpoint_id.location_id.id or self.order_id._get_destination_location(),
'picking_id': picking.id,
'partner_id': self.order_id.dest_address_id.id,
'move_dest_ids': [(4, x) for x in self.move_dest_ids.ids],
@@ -400,5 +400,5 @@ def _find_candidate(self, product_id, product_qty, product_uom, location_id, nam
args can be merged. If it returns an empty record then a new line will
be created.
"""
lines = self.filtered(lambda l: l.propagate_date == values['propagate_date'] and l.propagate_date_minimum_delta == values['propagate_date_minimum_delta'] and l.propagate_cancel == values['propagate_cancel'])
lines = self.filtered(lambda l: l.propagate_date == values['propagate_date'] and l.propagate_date_minimum_delta == values['propagate_date_minimum_delta'] and l.propagate_cancel == values['propagate_cancel'] and l.orderpoint_id == values['orderpoint_id'])
return lines and lines[0] or self.env['purchase.order.line']

0 comments on commit 3976a79

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