Rework of workflow, added the dock back. This is now the beginning of the SKU mismatch issues. FKN FUN TIMES AHEAD
This commit is contained in:
@@ -30,17 +30,21 @@ from app.models import Order
|
||||
from app.return_labels import is_emailed_label_order
|
||||
from app.schedule import get_cutoff_time, is_past_cutoff_today
|
||||
from app.status_rules import get_cancelled_statuses, status_in
|
||||
from app.ticket_validation import validate_ticket
|
||||
from app.tracking import get_fulfilled_statuses
|
||||
|
||||
CANCELLED_TEXT_COLOR = QColor(180, 0, 0)
|
||||
FULFILLED_ROW_COLOR = QColor(210, 240, 210)
|
||||
ISSUE_TEXT_COLOR = QColor(170, 100, 0)
|
||||
CHECK_MARK = "\u2713"
|
||||
WARNING_MARK = "\u26a0"
|
||||
|
||||
# Order here is display order, left to right.
|
||||
COLUMNS = [
|
||||
("company", "Company"),
|
||||
("ticket_number", "Ticket #"),
|
||||
("status", "Status"),
|
||||
("issues_display", "Issues"),
|
||||
("packed_display", "Done"),
|
||||
("skus_display", "SKUs"),
|
||||
("summary", "Summary"),
|
||||
@@ -108,9 +112,14 @@ class OrdersTableModel(QAbstractTableModel):
|
||||
|
||||
order = self._orders[index.row()]
|
||||
is_cancelled = status_in(order.status, self._cancelled_statuses)
|
||||
field_name, _ = COLUMNS[index.column()]
|
||||
|
||||
if role == Qt.ItemDataRole.ForegroundRole:
|
||||
return CANCELLED_TEXT_COLOR if is_cancelled else None
|
||||
if is_cancelled:
|
||||
return CANCELLED_TEXT_COLOR
|
||||
if field_name == "issues_display" and validate_ticket(order.skus, order.line_items):
|
||||
return ISSUE_TEXT_COLOR
|
||||
return None
|
||||
|
||||
if role == Qt.ItemDataRole.BackgroundRole:
|
||||
# Cancelled rows use red TEXT (above) instead of a background,
|
||||
@@ -121,11 +130,16 @@ class OrdersTableModel(QAbstractTableModel):
|
||||
return FULFILLED_ROW_COLOR
|
||||
return None
|
||||
|
||||
if role == Qt.ItemDataRole.ToolTipRole and field_name == "issues_display":
|
||||
issues = validate_ticket(order.skus, order.line_items)
|
||||
return "\n".join(i.message for i in issues) if issues else None
|
||||
|
||||
if role != Qt.ItemDataRole.DisplayRole:
|
||||
return None
|
||||
|
||||
field_name, _ = COLUMNS[index.column()]
|
||||
|
||||
if field_name == "issues_display":
|
||||
issues = validate_ticket(order.skus, order.line_items)
|
||||
return f"{WARNING_MARK} ({len(issues)})" if issues else ""
|
||||
if field_name == "skus_display":
|
||||
return ", ".join(order.skus or [])
|
||||
if field_name == "packed_display":
|
||||
|
||||
Reference in New Issue
Block a user