Skip to content
Snippets Groups Projects
Commit 46fc328d authored by David (dafr)'s avatar David (dafr)
Browse files

[FIX] purchase_stock: no overwrite of orderpoint.route_id


action_set_supplier doesn't have to overwrite the orderpoint.route_id if it already has one that fit the requirements (action = 'buy').

OPW-3746624

closes odoo/odoo#154436

X-original-commit: f52a1708
Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent fdaba15c
No related branches found
No related tags found
No related merge requests found
......@@ -115,7 +115,8 @@ class SupplierInfo(models.Model):
orderpoint = self.env['stock.warehouse.orderpoint'].browse(orderpoint_id)
if not orderpoint:
return
orderpoint.route_id = self.env['stock.rule'].search([('action', '=', 'buy')], limit=1).route_id.id
if 'buy' not in orderpoint.route_id.rule_ids.mapped('action'):
orderpoint.route_id = self.env['stock.rule'].search([('action', '=', 'buy')], limit=1).route_id.id
orderpoint.supplier_id = self
supplier_min_qty = self.product_uom._compute_quantity(self.min_qty, orderpoint.product_id.uom_id)
if orderpoint.qty_to_order < supplier_min_qty:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment