Skip to content

Commit

Permalink
shopfloor: display pickings by priority in checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
JuMiSanAr committed Nov 22, 2023
1 parent f7e91ce commit 4278a38
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions shopfloor/actions/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

Expand All @@ -72,6 +72,7 @@ def _picking_parser(self, **kw):
"bulk_line_count",
"total_weight:weight",
"scheduled_date",
"priority",
]

@ensure_model("stock.quant.package")
Expand Down
1 change: 1 addition & 0 deletions shopfloor/actions/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion shopfloor/services/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions shopfloor/tests/test_actions_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions shopfloor_mobile/static/wms/src/scenario/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ const Checkout = {
{path: "origin"},
{path: "carrier.name", label: "Carrier"},
{path: "move_line_count", label: "Lines"},
{path: "priority", label: "Priority"},
],
},
};
Expand Down

0 comments on commit 4278a38

Please sign in to comment.