[FIX] purchase_stock: purchase product route can't be triggered

To reproduce:
1. set WH receipt in 3 steps
2. create a "receipt in 2 steps" route for product
3. create a PO with product "receipt in 2 steps"
In inventory, we will see this product still follow the "receipt in 3
steps" route.

This is caused when we create move for PO, we prepare the route_ids
according to warehouse's route_ids. After the move has it's own
route_ids, it will not search for route set on product or product
category (which should has higher priority over warehouse route).
To fix it, we remove the route_ids when create the move for PO. A route
will be found when the move being comfirmed.

Task 2448439
PR #65509

Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
This commit is contained in:
yhu-odoo
2021-02-04 08:31:54 +00:00
parent 5925001c19
commit af9b926766
-1
View File
@@ -479,7 +479,6 @@ class PurchaseOrderLine(models.Model):
'origin': self.order_id.name,
'description_picking': product.description_pickingin or self.name,
'propagate_cancel': self.propagate_cancel,
'route_ids': self.order_id.picking_type_id.warehouse_id and [(6, 0, [x.id for x in self.order_id.picking_type_id.warehouse_id.route_ids])] or [],
'warehouse_id': self.order_id.picking_type_id.warehouse_id.id,
'product_uom_qty': product_uom_qty,
'product_uom': product_uom.id,