diff options
| author | Nicolas Martinelli <nim@odoo.com> | 2020-03-03 07:53:21 +0000 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2020-03-03 13:05:32 +0000 |
| commit | ed3f448e682a1fec032a52f9090ded5fdffa948a (patch) | |
| tree | bc6de960df97d97e48fca96bf002feb8c5f1c312 | |
| parent | 071b00f6a1cea4be52258499154222f095deb887 (diff) | |
[FIX] purchase_stock: deliver qui with different UoM
- Create a product A with UoM set to 'Units(s)'
- Create a product B with UoM set to 'Liter(s)'
- Create a BOM of type kit, 2 Liters of B to create 1 Unit of A
- Create a PO with A, validate
- Validate the corresponding picking
An error is raised since we try to compute the quantity received in
Units based on a quantity in Liters.
In case of a kit BOM, an override exists in `purchase_mrp` to compute
correctly the quantity. Therefore, we can skip the line.
Corresponding fix for SO: 47959438b6c106e6c9f2f8d849439edf370f390c
Closes #45871
opw-2205970
closes odoo/odoo#46748
X-original-commit: 2ad4621c03a1885f2bb210960ebe8b5ae277e439
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
| -rw-r--r-- | addons/purchase_stock/models/purchase.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/addons/purchase_stock/models/purchase.py b/addons/purchase_stock/models/purchase.py index a3db07965a6..18222c3e8b5 100644 --- a/addons/purchase_stock/models/purchase.py +++ b/addons/purchase_stock/models/purchase.py @@ -255,7 +255,9 @@ class PurchaseOrderLine(models.Model): for line in self: if line.qty_received_method == 'stock_moves': total = 0.0 - for move in line.move_ids: + # In case of a BOM in kit, the products delivered do not correspond to the products in + # the PO. Therefore, we can skip them since they will be handled later on. + for move in line.move_ids.filtered(lambda m: m.product_id == line.product_id): if move.state == 'done': if move.location_dest_id.usage == "supplier": if move.to_refund: |
