Added RubbbbiconMD SKU and updated SIGGNIGFY. Fixed some SKU mismatch bugs
This commit is contained in:
@@ -68,6 +68,16 @@ def check_company_mismatch(skus: List[str]) -> Optional[TicketIssue]:
|
||||
|
||||
|
||||
def check_return_device_mismatch(line_items: List[dict]) -> List[TicketIssue]:
|
||||
"""
|
||||
A return SKU's implied device type needs to match SOMETHING else on the
|
||||
ticket - either an actual device line item (break-fix: send the asset,
|
||||
return the same type) OR another shipping item of the same type (asset
|
||||
recovery: a box and a label for the same device, e.g. SH002 "Return Box
|
||||
iPad" + SH011 "Return Label iPad" - both are "shipping" items by our
|
||||
is-it-a-device check, and pairing them like this is correct, not a
|
||||
mismatch - confirmed against real examples: SH002/SH011, OK001/OK006,
|
||||
OK011/OK013).
|
||||
"""
|
||||
keyword_map = get_device_field_suggestions() # {keyword: [serial fields]} - keys only, here
|
||||
exempt_keywords = get_return_device_exempt_keywords()
|
||||
issues: List[TicketIssue] = []
|
||||
@@ -87,16 +97,22 @@ def check_return_device_mismatch(line_items: List[dict]) -> List[TicketIssue]:
|
||||
# nothing to check it against, so nothing to flag here either.
|
||||
continue
|
||||
|
||||
has_matching_device = any(
|
||||
matches_a_device = any(
|
||||
matched_keyword in item.get("item_name", "").lower() for item in device_items
|
||||
)
|
||||
if not has_matching_device:
|
||||
matches_another_shipping_item = any(
|
||||
matched_keyword in other.get("item_name", "").lower()
|
||||
for other in return_items
|
||||
if other is not return_item
|
||||
)
|
||||
if not matches_a_device and not matches_another_shipping_item:
|
||||
issues.append(
|
||||
TicketIssue(
|
||||
code="return_device_mismatch",
|
||||
message=(
|
||||
f"'{return_item.get('sku', '')}' ({return_item.get('item_name', '')}) "
|
||||
f"expects a matching '{matched_keyword}' device, but none is on this ticket"
|
||||
f"expects a matching '{matched_keyword}' device or box/label pair, "
|
||||
"but none is on this ticket"
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user