feat(bloco-c): motor fiscal com legal_basis obrigatorio, classificacao NCM, seguranca CEST/IPI e validador GTIN
This commit is contained in:
@@ -49,8 +49,14 @@ class Classifier:
|
||||
status, candidate = "EXACT_NCM", exact
|
||||
elif legacy:
|
||||
status, candidate = "LEGACY_NCM", None
|
||||
elif not code:
|
||||
status, candidate = self._candidate(entries, product.get("description"))
|
||||
elif len(set(code)) == 1 or code in ("00000000", "99999999", "11111111", "000000"):
|
||||
status, candidate = "PLACEHOLDER_NCM", None
|
||||
elif len(code) != 8 or code in ("12345678", "87654321"):
|
||||
status, candidate = "INVALID_FORMAT_NCM", None
|
||||
else:
|
||||
status, candidate = ("INVALID_NCM", None) if code else self._candidate(entries, product.get("description"))
|
||||
status, candidate = "OUT_OF_TABLE_NCM", None
|
||||
matched_code = candidate.code if candidate else legacy["code"] if legacy else None
|
||||
cests_available = matched_code and hasattr(self.repository, "cest_for_ncm")
|
||||
cests = self.repository.cest_for_ncm(matched_code) if cests_available else None
|
||||
|
||||
Reference in New Issue
Block a user