feat(partner): detect and resync partner mismatches on already-imported orders

Detects PF↔PJ transitions and CUI changes after import; auto-resyncs
uninvoiced orders (max 5/cycle) and shows visual alert for invoiced ones.
- SQLite: partner_mismatch column + batch helpers
- sync_service: detection loop + _resync_partner_for_order
- dashboard: red dot + attention card indicator
- modal: alert with contextual message and resync button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-08 16:19:26 +00:00
parent bf194eb088
commit 89c3d1d07f
11 changed files with 639 additions and 44 deletions

View File

@@ -124,7 +124,9 @@ def _parse_order(order_id: str, data: dict, source_file: str) -> OrderData:
# Parse billing
billing_data = data.get("billing", {}) or {}
company = billing_data.get("company")
is_company = isinstance(company, dict) and bool(company.get("name"))
is_company = isinstance(company, dict) and (
bool(company.get("name")) or bool(company.get("code"))
)
billing = OrderBilling(
firstname=str(billing_data.get("firstname", "")),