From 91ddb4fbdd22cf024ce93139010525f44792fffd Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Wed, 25 Mar 2026 22:01:30 +0000 Subject: [PATCH] fix(mappings): allow SKU=CODMAT mappings for quantity conversion Remove validation that blocked creating mappings when SKU matches an existing CODMAT. Users need this for unit quantity conversion (e.g., website sells 50 units per SKU but ROA tracks 100, requiring cantitate_roa=0.5). Co-Authored-By: Claude Opus 4.6 (1M context) --- api/app/services/mapping_service.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/api/app/services/mapping_service.py b/api/app/services/mapping_service.py index 3a626b5..b68373e 100644 --- a/api/app/services/mapping_service.py +++ b/api/app/services/mapping_service.py @@ -125,16 +125,6 @@ def create_mapping(sku: str, codmat: str, cantitate_roa: float = 1, auto_restore if cur.fetchone()[0] == 0: raise HTTPException(status_code=400, detail="CODMAT-ul nu exista in nomenclator") - # Warn if SKU is already a direct CODMAT in NOM_ARTICOLE - if sku == codmat: - cur.execute(""" - SELECT COUNT(*) FROM NOM_ARTICOLE - WHERE codmat = :sku AND sters = 0 AND inactiv = 0 - """, {"sku": sku}) - if cur.fetchone()[0] > 0: - raise HTTPException(status_code=409, - detail="SKU-ul exista direct in nomenclator ca CODMAT, nu necesita mapare") - # Check for active duplicate cur.execute(""" SELECT COUNT(*) FROM ARTICOLE_TERTI