diff --git a/shopfloor/actions/data.py b/shopfloor/actions/data.py index aaefbc06dc..1fdfcc8851 100644 --- a/shopfloor/actions/data.py +++ b/shopfloor/actions/data.py @@ -13,7 +13,7 @@ class DataAction(Component): def location(self, record, **kw): parser = self._location_parser data = self._jsonify(record.with_context(location=record.id), parser, **kw) - if "with_operation_progress" in kw: + if kw.get("with_operation_progress"): lines_blacklist = ( kw.get("progress_lines_blacklist") or self.env["stock.move.line"].browse() @@ -46,7 +46,7 @@ def _get_picking_parser(self, record, **kw): # and it may reduce performance significatively # when dealing with a large number of pickings. # Thus, we make it optional. - if "with_progress" in kw: + if kw.get("with_progress"): parser.append("progress") return parser @@ -72,6 +72,7 @@ def _picking_parser(self, **kw): "bulk_line_count", "total_weight:weight", "scheduled_date", + "priority", ] @ensure_model("stock.quant.package") diff --git a/shopfloor/actions/schema.py b/shopfloor/actions/schema.py index bfa0fdba4e..e474fe35de 100644 --- a/shopfloor/actions/schema.py +++ b/shopfloor/actions/schema.py @@ -27,6 +27,7 @@ def picking(self): "scheduled_date": {"type": "string", "nullable": False, "required": True}, "progress": {"type": "float", "nullable": True}, "location_dest": self._schema_dict_of(self.location(), required=False), + "priority": {"type": "string", "nullable": True, "required": False}, } def move_line(self, with_packaging=False, with_picking=False): diff --git a/shopfloor/services/checkout.py b/shopfloor/services/checkout.py index 01b8b6c81b..bcd69276ba 100644 --- a/shopfloor/services/checkout.py +++ b/shopfloor/services/checkout.py @@ -360,7 +360,7 @@ def _domain_for_list_stock_picking(self): ] def _order_for_list_stock_picking(self): - return "scheduled_date asc, id asc" + return "priority desc, scheduled_date asc, id asc" def list_stock_picking(self): """List stock.picking records available diff --git a/shopfloor/tests/test_actions_data.py b/shopfloor/tests/test_actions_data.py index 0fbe90233e..de502b4f76 100644 --- a/shopfloor/tests/test_actions_data.py +++ b/shopfloor/tests/test_actions_data.py @@ -155,6 +155,7 @@ def test_data_picking(self): "partner": {"id": self.customer.id, "name": self.customer.name}, "carrier": {"id": carrier.id, "name": carrier.name}, "ship_carrier": None, + "priority": "0", } self.assertEqual(data.pop("scheduled_date").split("T")[0], "2020-08-03") self.assertDictEqual(data, expected) @@ -179,6 +180,7 @@ def test_data_picking_with_progress(self): "carrier": {"id": carrier.id, "name": carrier.name}, "ship_carrier": None, "progress": 0.0, + "priority": "0", } self.assertEqual(data.pop("scheduled_date").split("T")[0], "2020-08-03") self.assertDictEqual(data, expected) diff --git a/shopfloor/views/shopfloor_menu.xml b/shopfloor/views/shopfloor_menu.xml index 868dc85c6c..5617de5f9e 100644 --- a/shopfloor/views/shopfloor_menu.xml +++ b/shopfloor/views/shopfloor_menu.xml @@ -112,6 +112,7 @@ name="scan_location_or_pack_first" attrs="{'invisible': [('scan_location_or_pack_first_is_possible', '=', False)]}" > +
+ {{ opts.label }} mdi-star