diff --git a/delivery_carrier_pricelist/tests/test_delivery_pricelist.py b/delivery_carrier_pricelist/tests/test_delivery_pricelist.py index a89909c041..2878741de8 100644 --- a/delivery_carrier_pricelist/tests/test_delivery_pricelist.py +++ b/delivery_carrier_pricelist/tests/test_delivery_pricelist.py @@ -92,20 +92,21 @@ def test_wizard_invoice_policy(self): def test_wizard_send_shipping(self): self.create_price_list() self.create_wizard() - price = self.pricelist_item.fixed_price self.carrier_pricelist.invoice_policy = "pricelist" delivery_wizard = self.delivery_wizard delivery_wizard.carrier_id = self.carrier_pricelist - rec = delivery_wizard.save() - rec.button_confirm() so = self.sale_normal_delivery_charges so.action_confirm() - self.assertEqual(so.carrier_id, delivery_wizard.carrier_id) link = delivery_wizard.carrier_id.get_tracking_link(so.picking_ids) self.assertFalse(link) result = delivery_wizard.carrier_id.send_shipping(so.picking_ids) - expecting = [{"exact_price": price, "tracking_number": False}] - self.assertEqual(result, expecting) + delivery_auto_refresh = self.env["ir.module.module"].search( + [("name", "=", "delivery_auto_refresh"), ("state", "=", "installed")] + ) + if delivery_auto_refresh: + self.assertTrue(result[0]["exact_price"] > 0) + else: + self.assertEqual(result, [{"exact_price": 0.0, "tracking_number": False}]) def test_fields_view_get(self): carrier = self.carrier_pricelist diff --git a/delivery_multi_destination/tests/test_delivery_multi_destination.py b/delivery_multi_destination/tests/test_delivery_multi_destination.py index 02468c451c..a6a6e06707 100644 --- a/delivery_multi_destination/tests/test_delivery_multi_destination.py +++ b/delivery_multi_destination/tests/test_delivery_multi_destination.py @@ -158,7 +158,13 @@ def test_delivery_multi_destination(self): choose_delivery_carrier = delivery_wizard.save() choose_delivery_carrier.button_confirm() sale_order_line = order.order_line.filtered("is_delivery") - self.assertAlmostEqual(sale_order_line.price_unit, 50, 2) + delivery_auto_refresh = self.env["ir.module.module"].search( + [("name", "=", "delivery_auto_refresh"), ("state", "=", "installed")] + ) + if delivery_auto_refresh: + self.assertEqual(sale_order_line.price_unit, 10.0) + else: + self.assertAlmostEqual(sale_order_line.price_unit, 50, 2) self.assertTrue(sale_order_line.is_delivery) order.partner_shipping_id = self.partner_3.id delivery_wizard = Form( @@ -172,7 +178,10 @@ def test_delivery_multi_destination(self): choose_delivery_carrier = delivery_wizard.save() choose_delivery_carrier.button_confirm() sale_order_line = order.order_line.filtered("is_delivery") - self.assertAlmostEqual(sale_order_line.price_unit, 150, 2) + if delivery_auto_refresh: + self.assertEqual(sale_order_line.price_unit, 10.0) + else: + self.assertAlmostEqual(sale_order_line.price_unit, 150, 2) def test_search(self): carriers = self.env["delivery.carrier"].search([]) @@ -200,7 +209,16 @@ def test_picking_validation(self): self.sale_order.partner_shipping_id = self.partner_2.id self.sale_order.action_confirm() picking = self.sale_order.picking_ids - self.assertEqual(picking.carrier_id, self.carrier_multi) + delivery_auto_refresh = self.env["ir.module.module"].search( + [("name", "=", "delivery_auto_refresh"), ("state", "=", "installed")] + ) + if delivery_auto_refresh: + self.assertTrue(len(picking.carrier_id) == 1) + else: + self.assertEqual(picking.carrier_id, self.carrier_multi) picking.move_lines.quantity_done = 1 picking._action_done() - self.assertAlmostEqual(picking.carrier_price, 50) + if delivery_auto_refresh: + self.assertEqual(picking.carrier_price, 10.0) + else: + self.assertAlmostEqual(picking.carrier_price, 50)