Skip to content

Commit

Permalink
[FIX] shopfloor: Fix zone_picking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lmignon committed May 2, 2024
1 parent 5d27a4e commit 3edc0d3
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
4 changes: 1 addition & 3 deletions shopfloor/actions/packaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ class PackagingAction(Component):
_usage = "packaging"

def packaging_valid_for_carrier(self, packaging, carrier):
return self.packaging_type_valide_for_carrier(
packaging.package_type_id, carrier
)
return self.packaging_type_valid_for_carrier(packaging.package_type_id, carrier)

def packaging_type_valid_for_carrier(self, packaging_type, carrier):
return packaging_type.package_carrier_type in (
Expand Down
2 changes: 1 addition & 1 deletion shopfloor/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DeliveryCarrierTest(models.Model):
selection_add=[("test", "TEST")], ondelete={"test": "set default"}
)
test_default_packaging_id = fields.Many2one(
"product.packaging", string="Default Package Type"
"stock.package.type", string="Default Package Type"
)


Expand Down
4 changes: 2 additions & 2 deletions shopfloor/tests/test_single_pack_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,8 +856,8 @@ def test_cancel_already_canceled(self):
response,
next_state="start",
message={
"message_type": "success",
"body": "Canceled, you can scan a new pack.",
"message_type": "error",
"body": "This operation does not exist anymore.",
},
)
package_level_b = self._simulate_started(self.pack_b)
Expand Down
2 changes: 1 addition & 1 deletion shopfloor/tests/test_zone_picking_select_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ def test_scan_source_barcode_package_can_replace_in_line(self):
picking1b.move_ids, in_package=True, location=self.zone_sublocation1
)
picking1b.action_assign()
picking1b.action_cancel()
package1b = picking1b.package_level_ids[0].package_id
picking1b.action_cancel()
package1 = self.picking1.package_level_ids[0].package_id
# 1st scan
response = self.service.dispatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def test_set_destination_increment_with_wrong_product(self):
def test_set_destination_increment_with_lot(self):
"""Check increment quantity by scanning the lot."""
picking_type = self.picking2.picking_type_id
move_line = self.picking2.move_line_ids[0]
move_line = self.picking2.move_line_ids.filtered("lot_id")[0]
# Scan twice the lot in a row to increment the quantity
for qty_done in range(2):
response = self.service.dispatch(
Expand Down
24 changes: 14 additions & 10 deletions shopfloor/tests/test_zone_picking_set_line_destination_pick_pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,11 @@ def setUpClassBaseData(cls, *args, **kwargs):
.sudo()
.create({"name": "TEST DEFAULT", "package_carrier_type": "test"})
)
default_pkging = (
cls.env["product.packaging"]
.sudo()
.create(
{"name": "TEST DEFAULT", "package_type_id": delivery_packaging_type.id}
)
)
cls.carrier.sudo().write(
{
"delivery_type": "test",
"integration_level": "rate", # avoid sending emails
"test_default_packaging_id": default_pkging.id,
"test_default_packaging_id": delivery_packaging_type.id,
}
)

Expand Down Expand Up @@ -121,7 +114,7 @@ def test_set_destination_location_ok_carrier(self):
delivery_pkg = move_line.result_package_id
self.assertNotIn(delivery_pkg, existing_packages)
self.assertEqual(
delivery_pkg.product_packaging_id, self.carrier.test_default_packaging_id
delivery_pkg.package_type_id, self.carrier.test_default_packaging_id
)
message = self.msg_store.confirm_pack_moved()
message["body"] += "\n" + self.msg_store.goods_packed_in(delivery_pkg)["body"]
Expand Down Expand Up @@ -201,7 +194,18 @@ def test_set_destination_package_full_qty_ok_carrier_ok_package(self):
self.assertEqual(len(moves_before.move_line_ids), 1)
move_line = moves_before.move_line_ids
move_line.picking_id.carrier_id = self.carrier
self.free_package.product_packaging_id = self.carrier.test_default_packaging_id
packaging = (
self.env["product.packaging"]
.sudo()
.create(
{
"name": "TEST DEFAULT",
"package_type_id": self.carrier.test_default_packaging_id.id,
}
)
)

self.free_package.product_packaging_id = packaging
response = self.service.dispatch(
"set_destination",
params={
Expand Down

0 comments on commit 3edc0d3

Please sign in to comment.