fix(price): skip price check for kit/complex articles

Kit articles (multi-component or cantitate_roa≠1) have expected price
differences between GoMag (commercial) and ROA (component sum).
Skip comparison entirely, mark with kit=True flag for UI badge.

Fix kit detection to use float()!=1 (catches cantitate_roa<1 like 0.5).
Update 3 existing tests + add multi-component kit test.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-04-02 13:01:41 +00:00
parent 219c821df4
commit ffd4cc0800
3 changed files with 38 additions and 11 deletions

View File

@@ -544,7 +544,7 @@ def sync_prices_from_order(orders, mapped_codmat_data: dict, direct_id_map: dict
# Build set of kit/bax SKUs (>1 component, or single component with cantitate_roa > 1)
kit_skus = {sku for sku, comps in mapped_codmat_data.items()
if len(comps) > 1 or (len(comps) == 1 and (comps[0].get("cantitate_roa") or 1) > 1)}
if len(comps) > 1 or (len(comps) == 1 and float(comps[0].get("cantitate_roa") or 1) != 1)}
updated = []
own_conn = conn is None
@@ -708,6 +708,12 @@ def get_prices_for_order(items: list[dict], app_settings: dict, conn=None) -> di
and float(codmat_details[0].get("cantitate_roa") or 1) != 1
)
if is_kit:
# Kit/pachet: prețul GoMag e comercial, ROA e suma componente din lista
# de prețuri — diferența e gestionată de discount line
result_items[idx]["kit"] = True
continue
pret_roa_total = 0.0
all_resolved = True