[MIG] rma: Migration to v17

This commit is contained in:
Carlos Vallés Fuster
2024-05-06 17:08:18 +02:00
committed by AaronHForgeFlow
parent e23335cee5
commit cb5a8a1ddd
19 changed files with 193 additions and 217 deletions

View File

@@ -10,7 +10,7 @@ class TestRma(common.TransactionCase):
@classmethod
def setUpClass(cls):
super(TestRma, cls).setUpClass()
super().setUpClass()
# models
cls.rma_make_picking = cls.env["rma_make_picking.wizard"]
cls.make_supplier_rma = cls.env["rma.order.line.make.supplier.rma"]
@@ -109,7 +109,8 @@ class TestRma(common.TransactionCase):
picking = cls.env["stock.picking"].browse(res["res_id"])
picking.action_assign()
for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty
mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done()
return picking
@@ -128,7 +129,8 @@ class TestRma(common.TransactionCase):
picking = cls.env["stock.picking"].browse(res["res_id"])
picking.action_assign()
for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty
mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done()
return picking
@@ -168,9 +170,8 @@ class TestRma(common.TransactionCase):
picking.action_confirm()
picking.action_assign()
for ml in picking.move_ids:
ml.filtered(
lambda m: m.state != "waiting"
).quantity_done = ml.product_uom_qty
ml.filtered(lambda m: m.state != "waiting").quantity = ml.product_uom_qty
ml.filtered(lambda m: m.state != "waiting").picked = True
picking.button_validate()
@classmethod
@@ -443,38 +444,39 @@ class TestRma(common.TransactionCase):
)
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3,
"Wrong qty to receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_incoming,
lines.filtered(lambda x: x.product_id == self.product_1).qty_incoming,
3,
"Wrong qty incoming",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_2).qty_to_receive,
5,
"Wrong qty to receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_incoming,
lines.filtered(lambda x: x.product_id == self.product_2).qty_incoming,
5,
"Wrong qty incoming",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_3).qty_to_receive,
2,
"Wrong qty to receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_incoming,
lines.filtered(lambda x: x.product_id == self.product_3).qty_incoming,
2,
"Wrong qty incoming",
)
picking.action_assign()
for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty
mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done()
lines = self.rma_customer_id.rma_line_ids
self.assertEqual(
@@ -491,32 +493,32 @@ class TestRma(common.TransactionCase):
)
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received,
lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
3,
"Wrong qty received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3,
"Wrong qty to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received,
lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
5,
"Wrong qty received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5,
"Wrong qty to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received,
lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
2,
"Wrong qty received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2,
"Wrong qty to_deliver",
)
@@ -562,38 +564,39 @@ class TestRma(common.TransactionCase):
)
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3,
"Wrong qty to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_outgoing,
lines.filtered(lambda x: x.product_id == self.product_1).qty_outgoing,
3,
"Wrong qty outgoing",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5,
"Wrong qty to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_outgoing,
lines.filtered(lambda x: x.product_id == self.product_2).qty_outgoing,
5,
"Wrong qty outgoing",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2,
"Wrong qty to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_outgoing,
lines.filtered(lambda x: x.product_id == self.product_3).qty_outgoing,
2,
"Wrong qty outgoing",
)
picking.action_assign()
for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty
mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done()
lines = self.rma_customer_id.rma_line_ids
self.assertEqual(
@@ -607,32 +610,32 @@ class TestRma(common.TransactionCase):
)
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received,
lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
3,
"Wrong qty_received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_1).qty_delivered,
3,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received,
lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
5,
"Wrong qty_received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_2).qty_delivered,
5,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received,
lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
2,
"Wrong qty_received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_3).qty_delivered,
2,
"Wrong qty_delivered",
)
@@ -702,17 +705,17 @@ class TestRma(common.TransactionCase):
self.assertEqual(list(set(lines.mapped("qty_delivered"))), [0], "qty_delivered")
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3,
"Wrong qty_to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5,
"Wrong qty_to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2,
"Wrong qty_to_deliver",
)
@@ -720,21 +723,21 @@ class TestRma(common.TransactionCase):
lines.env.invalidate_all()
self._check_equal_quantity(
lines.filtered(
lambda l: l.product_id == self.product_1
lambda x: x.product_id == self.product_1
).qty_in_supplier_rma,
3,
"Wrong qty_in_supplier_rma",
)
self._check_equal_quantity(
lines.filtered(
lambda l: l.product_id == self.product_2
lambda x: x.product_id == self.product_2
).qty_in_supplier_rma,
5,
"Wrong qty_in_supplier_rma",
)
self._check_equal_quantity(
lines.filtered(
lambda l: l.product_id == self.product_3
lambda x: x.product_id == self.product_3
).qty_in_supplier_rma,
2,
"Wrong qty_in_supplier_rma",
@@ -791,32 +794,32 @@ class TestRma(common.TransactionCase):
)
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3,
"Wrong qty_to_receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_deliver,
3,
"Wrong qty_to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_2).qty_to_receive,
5,
"Wrong qty_to_receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_2).qty_to_deliver,
5,
"Wrong qty_to_deliver",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_3).qty_to_receive,
2,
"Wrong qty_to_receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_deliver,
lines.filtered(lambda x: x.product_id == self.product_3).qty_to_deliver,
2,
"Wrong qty_to_deliver",
)
@@ -825,7 +828,8 @@ class TestRma(common.TransactionCase):
)
picking.action_assign()
for mv in picking.move_ids:
mv.quantity_done = mv.product_uom_qty
mv.quantity = mv.product_uom_qty
mv.picked = True
picking._action_done()
self.assertEqual(
list(set(lines.mapped("qty_incoming"))), [0], "Wrong qty_incoming"
@@ -839,37 +843,37 @@ class TestRma(common.TransactionCase):
self.assertEqual(list(set(lines.mapped("qty_outgoing"))), [0], "qty_outgoing")
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_1).qty_delivered,
3,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3,
"Wrong qty_to_receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received,
lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
0,
"Wrong qty_received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_2).qty_delivered,
5,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received,
lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
0,
"Wrong qty_received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_3).qty_delivered,
2,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received,
lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
0,
"Wrong qty_received",
)
@@ -911,24 +915,25 @@ class TestRma(common.TransactionCase):
)
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_1).qty_to_receive,
3,
"Wrong qty_to_receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_2).qty_to_receive,
5,
"Wrong qty_to_receive",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_to_receive,
lines.filtered(lambda x: x.product_id == self.product_3).qty_to_receive,
2,
"Wrong qty_to_receive",
)
picking_in.action_confirm()
picking_in.action_assign()
for mv in picking_in.move_line_ids:
mv.qty_done = mv.reserved_uom_qty
mv.quantity = mv.quantity_product_uom
mv.picked = True
picking_in._action_done()
self.assertEqual(
list(set(lines.mapped("qty_outgoing"))), [0], "Wrong qty_outgoing"
@@ -942,32 +947,32 @@ class TestRma(common.TransactionCase):
# product specific
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_1).qty_delivered,
3,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_1).qty_received,
lines.filtered(lambda x: x.product_id == self.product_1).qty_received,
3,
"Wrong qty_received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_2).qty_delivered,
5,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_2).qty_received,
lines.filtered(lambda x: x.product_id == self.product_2).qty_received,
5,
"Wrong qty_received",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_delivered,
lines.filtered(lambda x: x.product_id == self.product_3).qty_delivered,
2,
"Wrong qty_delivered",
)
self._check_equal_quantity(
lines.filtered(lambda l: l.product_id == self.product_3).qty_received,
lines.filtered(lambda x: x.product_id == self.product_3).qty_received,
2,
"Wrong qty_received",
)