Skip to content

Commit e23a7af

Browse files
author
Sergio Garcia
committed
Pequenas correções no leiaute do ECF 2016.
1 parent 317b0cf commit e23a7af

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,4 @@ build/
4545

4646

4747
.env/
48+
/.pytest_cache/

sped/blocos.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@
44

55

66
class Bloco(object):
7-
def __init__(self):
7+
def __init__(self, nome):
8+
self._nome = nome
89
self._registros = []
910
self.registro_abertura = Registro()
1011
self.registro_encerramento = Registro()
1112

13+
def __repr__(self):
14+
return f'<{self.__class__.__module__}.{self.__class__.__name__}({self._nome})>'
15+
1216
@property
1317
def abertura(self):
1418
# Define o indicador de movimento ou dados

sped/escrituracao.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __init__(self, tipo: str, ano_calendario: int):
9090
p = json.load(f)
9191

9292
for bloco in p['blocos']:
93-
self._blocos[bloco['nome']] = Bloco()
93+
self._blocos[bloco['nome']] = Bloco(bloco['nome'])
9494

9595
for registro in p['registros']:
9696
campos = []
@@ -131,7 +131,7 @@ def __init__(self, tipo: str, ano_calendario: int):
131131
continue
132132

133133
# Campo CNPJ ou CPF
134-
if 'REGRA_VALIDA_CNPJ' in regras and 'REGRA_VALIDA_CPF' in regras:
134+
if 'REGRA_VALIDA_CNPJ' in regras and 'REGRA_VALIDA_CPF' in regras or nome == 'IDENT_CPF_CNPJ' or nome == 'CPF_CNPJ':
135135
campos.append(CampoCPFouCNPJ(indice, nome, obrigatorio=obrigatorio))
136136
continue
137137

@@ -145,7 +145,6 @@ def __init__(self, tipo: str, ano_calendario: int):
145145
campos.append(CampoCPF(indice, nome, obrigatorio=obrigatorio))
146146
continue
147147

148-
149148
# CampoAlfaNumerico
150149
if tipo == 'C':
151150
campos.append(CampoAlfanumerico(indice, nome, obrigatorio=obrigatorio, tamanho=campo['tamanho']))
@@ -210,7 +209,13 @@ def prepare(self):
210209

211210
for reg in regs.keys():
212211
registro = self.registros.Registro9900() # pylint: disable=E1101
213-
registro.REG_BLC = reg
212+
try:
213+
registro.REG_BLC = reg
214+
except:
215+
for rrr in bloco.registros:
216+
print(rrr)
217+
print(locals())
218+
raise
214219
registro.QTD_REG_BLC = regs[reg]
215220
bloco_9.add(registro)
216221

sped/leiautes/ecd_2016.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3458,7 +3458,7 @@
34583458
"tipo": "C",
34593459
"tamanho": 4,
34603460
"decimal": null,
3461-
"valores": "[\"J930\"]",
3461+
"valores": "\"J930\"",
34623462
"obrigatorio": true,
34633463
"regras": []
34643464
},

0 commit comments

Comments
 (0)