fix: kit discount amount + price sync no auto-insert + repackaging kit detection

Kit discount: v_disc_amt is per-kit, not per-unit — remove division by
v_cantitate_web so discount lines compute correctly (e.g. -2 x 5 = -10).

Price sync: stop auto-inserting missing articles into price policies
(was inserting with wrong proc_tvav from GoMag). Log warning instead.

Kit detection: extend to single-component repackagings (cantitate_roa > 1)
in both PL/SQL package and price sync/validation services.

Add repackaging kit pricing test for separate_line and distributed modes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude Agent
2026-03-21 11:04:09 +00:00
parent 10c1afca01
commit 61ae58ef25
6 changed files with 245 additions and 49 deletions

View File

@@ -1,6 +1,9 @@
-- Cleanup test data created for Phase 1 validation tests
-- Remove test articles and mappings to leave database clean
-- Remove test price entry
DELETE FROM crm_politici_pret_art WHERE id_pol = 1 AND id_articol = 9999001;
-- Remove test mappings
DELETE FROM ARTICOLE_TERTI WHERE sku IN ('CAFE100', '8000070028685', 'TEST001');