Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14.0] shopfloor: add option to order pickings by priority #770

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just change this line to `priority desc, scheduled_date asc, id asc" and drop all the rest that looks overkill

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I also add the button to choose how to sort them, like in zone_picking? Or just leave it ordered by priority first all the time?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just pushed the updated version, without the button.

return "priority desc, scheduled_date asc, id asc"

def list_stock_picking(self):
"""List stock.picking records available
Expand Down
1 change: 1 addition & 0 deletions shopfloor/views/shopfloor_menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
name="scan_location_or_pack_first"
attrs="{'invisible': [('scan_location_or_pack_first_is_possible', '=', False)]}"
>
<field name="scenario_key" invisible="1" />
<field name="scan_location_or_pack_first_is_possible" invisible="1" />
<field name="scan_location_or_pack_first" />
<div
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
Loading