Skip to content
Snippets Groups Projects
Commit d4af926a authored by Adrien Widart (awt)'s avatar Adrien Widart (awt)
Browse files

[IMP] purchase_stock: add test


A commit [1] has recently be added to fix an issue. It actually fixes
another issue too:
1. Create a product P
    - Storable
    - With one packaging PK for 10 x P
2. Create and confirm a PO
    - Order Lines:
        - 10 x P with PK
3. On the PO, decrease the quantity of P to 8

Without [1], a return is created for the difference. With [1], the
existing picking is correctly updated.

This commit adds a test to protect the use case.

[1] 20fa7c6f

OPW-3027110

closes odoo/odoo#105430

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 7a1e8592
Branches
Tags
No related merge requests found
......@@ -452,3 +452,26 @@ class TestPurchaseOrder(ValuationReconciliationTestCommon):
with po_form.order_line.edit(0) as pol_form:
pol_form.product_qty = 25
self.assertEqual(pol.name, "[C02] Name02")
def test_packaging_and_qty_decrease(self):
packaging = self.env['product.packaging'].create({
'name': "Super Packaging",
'product_id': self.product_a.id,
'qty': 10.0,
})
po_form = Form(self.env['purchase.order'])
po_form.partner_id = self.partner_a
with po_form.order_line.new() as line:
line.product_id = self.product_a
line.product_qty = 10
po = po_form.save()
po.button_confirm()
self.assertEqual(po.order_line.product_packaging_id, packaging)
with Form(po) as po_form:
with po_form.order_line.edit(0) as line:
line.product_qty = 8
self.assertEqual(po.picking_ids.move_lines.product_uom_qty, 8)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment