diff --git a/sale_order_line_delivery_state/__manifest__.py b/sale_order_line_delivery_state/__manifest__.py index 70cd5f9659a2..5d8a33882c79 100644 --- a/sale_order_line_delivery_state/__manifest__.py +++ b/sale_order_line_delivery_state/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Sale Order Line Delivery State", "summary": "Show the delivery state on the sale order line", - "version": "16.0.1.0.0", + "version": "17.0.1.0.0", "category": "Product", "website": "https://github.com/OCA/sale-workflow", "author": "ForgeFlow, Odoo Community Association (OCA)", diff --git a/sale_order_line_delivery_state/tests/test_sale_line_delivery_state.py b/sale_order_line_delivery_state/tests/test_sale_line_delivery_state.py index fd115d983e47..3a12353f4281 100644 --- a/sale_order_line_delivery_state/tests/test_sale_line_delivery_state.py +++ b/sale_order_line_delivery_state/tests/test_sale_line_delivery_state.py @@ -14,7 +14,7 @@ def setUpClass(cls): # Base data partner = cls.env.ref("base.res_partner_2") product = cls.env.ref("product.product_product_25") - pricelist = cls.env.ref("product.list0") + pricelist = cls.env["product.pricelist"].create({"name": "Test Pricelist"}) cls.uom = cls.env.ref("uom.product_uom_unit") # Create delivery product cls.delivery_cost = cls.env["product.product"].create( @@ -106,6 +106,12 @@ def test_forced_delivery_cost(self): self.order.order_line[0].force_delivery_state = True self.assertEqual(self.order.order_line[0].delivery_state, "done") self.assertEqual(self.order.order_line[1].delivery_state, "no") + self.order.order_line[0].action_force_delivery_state() + # Assert the delivery state is set to done + self.assertEqual(self.order.order_line[0].delivery_state, "done") + self.order.order_line[0].action_unforce_delivery_state() + # Assert the delivery state is back to partially + self.assertEqual(self.order.order_line[0].delivery_state, "partially") def test_delivery_done_delivery_cost(self): self._add_delivery_cost_line() diff --git a/sale_order_line_delivery_state/views/sale_order_views.xml b/sale_order_line_delivery_state/views/sale_order_views.xml index cb94bddfcb39..a742028042cf 100644 --- a/sale_order_line_delivery_state/views/sale_order_views.xml +++ b/sale_order_line_delivery_state/views/sale_order_views.xml @@ -18,14 +18,14 @@ type="object" string="Force delivery done" states="done" - attrs="{'invisible': ['|', ('force_delivery_state', '=', True), ('delivery_state', '=', 'done')]}" + invisible="force_delivery_state or state == 'done'" />