|
46 | 46 | # name -- those resolve on their own via layers 1-2. |
47 | 47 | # --------------------------------------------------------------------------- |
48 | 48 | SEARCH_ALIASES = { |
49 | | - "billing": ["invoice", "invoiceitem", "charge", "payment_intent"], |
50 | | - "payee": ["payout", "refund"], |
51 | | - "payer": ["customer", "charge"], |
52 | | - "shipping": ["stock.picking", "stock.move"], |
53 | | - "logistics": ["Supply Chain / Logistics"], |
54 | | - "stock": ["stock.quant", "stock.lot", "material_lot"], |
55 | | - "warehouse": ["Inventory / Warehouse"], |
56 | | - "vendor": ["purchase_order", "payout"], |
57 | | - "supplier": ["purchase_order"], |
58 | | - "hr": ["Human Resources"], |
59 | | - "people": ["person", "patient", "customer", "hr.employee"], |
60 | | - "bom": ["bom", "bom_item", "bom_operation", "mrp.bom"], |
| 49 | + # --- Finance / billing --- |
| 50 | + "billing": ["invoice", "invoiceitem", "charge", "payment_intent"], |
| 51 | + "payee": ["payout", "refund"], |
| 52 | + "payer": ["customer", "charge"], |
| 53 | + "receivable": ["invoice", "invoiceitem"], |
| 54 | + "payable": ["purchase_order", "payout"], |
| 55 | + "ap": ["purchase_order", "payout"], |
| 56 | + "ledger": ["account.move", "account.move.line"], |
| 57 | + "journal": ["account.move", "account.move.line"], |
| 58 | + "gl": ["account.move", "account.move.line"], |
| 59 | + "tax": ["account.invoice.tax", "invoice"], |
| 60 | + # --- CRM / parties --- |
| 61 | + "client": ["customer", "account", "party.party", "organization"], |
| 62 | + "company": ["organization", "account"], |
| 63 | + "partner": ["party.party", "organization", "account"], |
| 64 | + "prospect": ["lead", "opportunity"], |
| 65 | + "address": ["party.address"], |
| 66 | + # --- Sales --- |
| 67 | + "quotation": ["quote", "offer"], |
| 68 | + "deal": ["opportunity", "quote"], |
| 69 | + "pricing": ["price", "offer"], |
| 70 | + # --- Procurement --- |
| 71 | + "po": ["purchase_order"], |
| 72 | + "rfq": ["purchase_order"], |
| 73 | + "vendor": ["purchase_order", "payout"], |
| 74 | + "supplier": ["purchase_order"], |
| 75 | + # --- Inventory / supply chain --- |
| 76 | + "shipping": ["stock.picking", "stock.move"], |
| 77 | + "delivery": ["stock.picking", "stock.move"], |
| 78 | + "transfer": ["stock.picking", "stock.move"], |
| 79 | + "fulfillment": ["stock.picking", "order"], |
| 80 | + "lot": ["stock.lot", "material_lot"], |
| 81 | + "batch": ["stock.lot", "material_lot"], |
| 82 | + "serial": ["stock.lot", "material_lot"], |
| 83 | + # --- Human Resources --- |
| 84 | + "employee": ["hr.employee", "person", "personnel_class"], |
| 85 | + "staff": ["hr.employee", "person"], |
| 86 | + "worker": ["hr.employee", "person"], |
| 87 | + "department": ["hr.department"], |
| 88 | + "position": ["hr.job"], |
| 89 | + "people": ["person", "patient", "customer", "hr.employee"], |
| 90 | + # --- Healthcare --- |
| 91 | + "appointment": ["patient_appointment"], |
| 92 | + "visit": ["patient_encounter", "encounter"], |
| 93 | + "vitals": ["vital_signs"], |
| 94 | + "diagnosis": ["clinical_procedure", "observation"], |
| 95 | + "doctor": ["practitioner"], |
| 96 | + "physician": ["practitioner"], |
| 97 | + "provider": ["practitioner"], |
| 98 | + "insurance": ["coverage"], |
| 99 | + # --- Manufacturing --- |
| 100 | + "mfg": ["Manufacturing"], |
| 101 | + "workcenter": ["mrp.workcenter", "workstation"], |
| 102 | + "assembly": ["bom", "mrp.bom", "work_order"], |
| 103 | + # --- Quality --- |
| 104 | + "qa": ["Quality Management"], |
| 105 | + "qc": ["Quality Management"], |
| 106 | + "inspection": ["quality_inspection", "quality_inspection_reading"], |
| 107 | + "defect": ["non_conformance"], |
| 108 | + "nonconformance": ["non_conformance"], |
| 109 | + # --- Product --- |
| 110 | + "sku": ["product", "price"], |
| 111 | + "catalog": ["product", "price"], |
| 112 | + "item": ["product", "price"], |
| 113 | + "barcode": ["gs1"], |
61 | 114 | } |
62 | 115 |
|
63 | 116 | FIELD_COLS = ("Name", "Title", "Description", "DataType", "ByteLength", |
@@ -121,7 +174,11 @@ def resolve(conn, term): |
121 | 174 | if term.lower() in SEARCH_ALIASES: |
122 | 175 | seen, items, targets = set(), [], [] |
123 | 176 | for tgt in SEARCH_ALIASES[term.lower()]: |
124 | | - sub = _items_for_category(conn, tgt) or _items_for_entity(conn, tgt) |
| 177 | + # entity-first: a target like "order" means the order entity, not |
| 178 | + # the whole "Sales / Order Management" category. Multi-word category |
| 179 | + # names (e.g. "Quality Management") won't match an entity and fall |
| 180 | + # through to the category lookup. |
| 181 | + sub = _items_for_entity(conn, tgt) or _items_for_category(conn, tgt) |
125 | 182 | if sub: |
126 | 183 | targets.append(tgt) |
127 | 184 | for r in sub: |
|
0 commit comments