fix(repair): use customer.name instead of first_name in _enrich_ticket

This commit is contained in:
iFixKart Dev 2026-11-16 18:46:16 +05:30
parent 65f23224c0
commit 96599e9562

View file

@ -98,13 +98,12 @@ class RepairErpService:
t.problem_description = t.issue_description t.problem_description = t.issue_description
t.priority = "NORMAL" t.priority = "NORMAL"
if getattr(t, "customer", None): if getattr(t, "customer", None):
name_parts = [t.customer.first_name, t.customer.last_name or ""] t.customer_name = getattr(t.customer, "name", None) or getattr(t.customer, "first_name", "") or "Customer"
t.customer_name = " ".join(p for p in name_parts if p).strip() or "Customer" t.customer_phone = getattr(t.customer, "phone", "") or ""
t.customer_phone = t.customer.phone or ""
if getattr(t, "device", None): if getattr(t, "device", None):
t.brand_name = t.device.brand or "" t.brand_name = getattr(t.device, "brand", "") or ""
t.model_name = t.device.model_name or "" t.model_name = getattr(t.device, "model_name", "") or ""
t.imei_serial = t.device.imei_serial or "" t.imei_serial = getattr(t.device, "imei_serial", "") or ""
return t return t
def get_ticket(self, ticket_id: str) -> Optional[CrmRepairTicket]: def get_ticket(self, ticket_id: str) -> Optional[CrmRepairTicket]: