fix: always sync economic_customer_number from e-conomic (v1.3.56)
- Fixed UPDATE query to include economic_customer_number field - Previously only set on INSERT, not UPDATE when matching by CVR - Now e-conomic customer number is always synced as source of truth - Fixes issue where customers synced from e-conomic were missing customer numbers
This commit is contained in:
parent
38a47f4d27
commit
0833f149e1
@ -502,10 +502,11 @@ async def sync_from_economic() -> Dict[str, Any]:
|
||||
)
|
||||
|
||||
if existing:
|
||||
# Update existing customer
|
||||
# Update existing customer (always sync economic_customer_number from e-conomic)
|
||||
update_query = """
|
||||
UPDATE customers SET
|
||||
name = %s,
|
||||
economic_customer_number = %s,
|
||||
cvr_number = %s,
|
||||
email_domain = %s,
|
||||
city = %s,
|
||||
@ -516,7 +517,7 @@ async def sync_from_economic() -> Dict[str, Any]:
|
||||
WHERE id = %s
|
||||
"""
|
||||
execute_query(update_query, (
|
||||
name, cvr, email_domain, city, zip_code, country, website, existing[0]['id']
|
||||
name, customer_number, cvr, email_domain, city, zip_code, country, website, existing[0]['id']
|
||||
))
|
||||
updated_count += 1
|
||||
logger.info(f"✏️ Opdateret: {name} (e-conomic #{customer_number}, CVR: {cvr or 'ingen'})")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user