feat: configurable vehicle compatibility source (TecDoc / QWEN / Both)
Backend: - Added GET/PUT /pos/api/config/vehicle-compat-source endpoints - Added get_compat_source() helper reading from tenant_config - create_item() now respects config: runs TecDoc and/or QWEN accordingly - auto_match_item_vehicles() respects config: runs only configured source Frontend: - Added 'Compatibilidad de Vehiculos' section in config.html - Added loadVehicleCompatSource() / saveVehicleCompatSource() in config.js - Regenerated config.min.js
This commit is contained in:
@@ -12,6 +12,29 @@ Features:
|
||||
from typing import List, Dict, Optional
|
||||
|
||||
|
||||
def get_compat_source(tenant_id):
|
||||
"""Return the configured compatibility source: 'tecdoc', 'qwen', or 'both'.
|
||||
|
||||
Reads from tenant_config table. Defaults to 'both'.
|
||||
"""
|
||||
from tenant_db import get_tenant_conn
|
||||
try:
|
||||
conn = get_tenant_conn(tenant_id)
|
||||
cur = conn.cursor()
|
||||
cur.execute(
|
||||
"SELECT value FROM tenant_config WHERE key = 'vehicle_compat_source'"
|
||||
)
|
||||
row = cur.fetchone()
|
||||
cur.close()
|
||||
conn.close()
|
||||
source = row[0] if row else 'both'
|
||||
if source in ('tecdoc', 'qwen', 'both'):
|
||||
return source
|
||||
except Exception:
|
||||
pass
|
||||
return 'both'
|
||||
|
||||
|
||||
def auto_match_vehicle_compatibility(master_conn, tenant_conn, inventory_id, part_number,
|
||||
brand=None, name=None):
|
||||
"""Find vehicle compatibility for an inventory item by part_number.
|
||||
|
||||
Reference in New Issue
Block a user