feat(missao-6): finalizacao descoberta P5-P6, compatibilidade do motor e atualizacao PROJECT_STATE

This commit is contained in:
gti
2026-09-28 16:40:07 -03:00
parent d383332150
commit f5893ac860
5 changed files with 128 additions and 81 deletions
+11 -5
View File
@@ -317,14 +317,20 @@ def resolve_product(p, d, company, refs, ev, ctx, manual_ncm=None):
# store_ipi_profile / contribuinte_ipi gate
is_taxpayer = company.get("contribuinte_ipi") == "S"
prof, _ = ctx.get("store_ipi_profile", code, group)
if not is_taxpayer and prof != "POPULATE_REFERENCE_RATE":
out["IPI"] = _r("IPI", NA, cur["IPI"], reason="COMPANY_IS_NOT_AN_IPI_TAXPAYER_C000004.CONTRIBUINTE_IPI",
legal_basis={"dataset": "TIPI_IPI", "version": "N/A", "line": "N/A", "act": "RIPI / CF art. 153, IV (não contribuinte)"})
if not is_taxpayer:
if prof == "POPULATE_REFERENCE_RATE":
pass
elif prof == "LEAVE_NOT_APPLICABLE":
out["IPI"] = _r("IPI", NA, cur["IPI"], reason="STORE_IPI_PROFILE_LEAVE_NOT_APPLICABLE",
legal_basis={"dataset": "TIPI_IPI", "version": "N/A", "line": "N/A", "act": "RIPI / CF art. 153, IV (não contribuinte)"})
elif prof is None and out["IPI"]["state"] == CHANGE:
out["IPI"] = _r("IPI", MANUAL, cur["IPI"], reason="STORE_IPI_PROFILE_NOT_DECIDED", key="store_ipi_profile", scope="COMPANY")
else:
out["IPI"] = _r("IPI", NA, cur["IPI"], reason="COMPANY_IS_NOT_AN_IPI_TAXPAYER_C000004.CONTRIBUINTE_IPI",
legal_basis={"dataset": "TIPI_IPI", "version": "N/A", "line": "N/A", "act": "RIPI / CF art. 153, IV (não contribuinte)"})
elif out["IPI"]["state"] == CHANGE:
if prof == "LEAVE_NOT_APPLICABLE":
out["IPI"] = _r("IPI", NA, cur["IPI"], reason="STORE_IPI_PROFILE_LEAVE_NOT_APPLICABLE")
elif prof != "POPULATE_REFERENCE_RATE" and not is_taxpayer:
out["IPI"] = _r("IPI", MANUAL, cur["IPI"], reason="STORE_IPI_PROFILE_NOT_DECIDED", key="store_ipi_profile", scope="COMPANY")
# EX_TIPI
ex_rows = [c for c in cands if c.get("ex")]
if ex_ctx: