-
-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,263 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_sped_base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
|0000|LECD|01012021|31122021|EMPRESA TESTE LIVRO RAZAO AUXILIAR|11111111000191|ES|ISENTO|3205200|1256535||0|0|0||0|1||N|N|0|0|1| | ||
|0001|0| | ||
|0007|00|| | ||
|0990|4| | ||
|I001|0| | ||
|I010|Z|9.00| | ||
|I012|1|LIVRO DIÁRIO COM ESCRITURAÇÃO RESUMIDA|0|| | ||
|I015|1.01.01.01| | ||
|I015|1.05.05.05| | ||
|I015|1.07.07.07| | ||
|I015|1.09.09.09| | ||
|I030|TERMO DE ABERTURA|1|RAZAO_AUXILIAR_DAS_SUBCONTAS|99|EMPRESA TESTE LIVRO RAZAO AUXILIAR||11111111000191|15021978||BRASILIA|31122021| | ||
|I050|01012015|01|S|1|1.01.01.01||Ativo Sintética 1| | ||
|I050|01012015|01|S|1|1.05.05.05||Ativo Sintética 2| | ||
|I050|01012015|01|S|1|1.07.07.07||Ativo Sintética 3| | ||
|I050|01012015|01|S|1|1.09.09.09||Ativo Sintética 4| | ||
|I510|NAT_SUB_CNT|NATUREZA DA SUBCONTA CORRELATA|C|2||11| | ||
|I510|COD_SUB_CNT|CÓDIGO DA SUBCONTA VINCULADA AO ITEM|C|20||11| | ||
|I510|COD_CCUS|CÓDIGO DO CENTRO DE CUSTOS VINCULADO AO ITEM|C|20||11| | ||
|I510|CNPJ_INVTD|CNPJ DA INVESTIDA|N|14||11| | ||
|I510|COD_PATR_ITEM|CÓDIGO DE IDENTIFICAÇÃO DO ITEM|C|10||11| | ||
|I510|QTD|QUANTIDADE|N|15||11| | ||
|I510|IDENT_ITEM|IDENTIFICADOR DO ITEM|C|30||11| | ||
|I510|DESCR_ITEM|DESCRICAO DO ITEM|C|50||11| | ||
|I510|DATA_RECT_INI|DATA DO RECONHECIMENTO CONTÁBIL INICIAL DO ITEM|C|8||11| | ||
|I510|SLD_ITEM_INI|SALDO INICIAL DA CONTA CONTÁBIL|N|19|2|11| | ||
|I510|IND_SLD_ITEM_INI|INDICADOR DO SALDO INICIAL|C|1||11| | ||
|I510|REAL_ITEM|PARCELA DE REALIZAÇÃO DO ITEM|N|19|2|11| | ||
|I510|IND_REAL_ITEM|INDICADOR DA PARCELA DE REALIZAÇÃO|C|1||11| | ||
|I510|SLD_ITEM_FIN|SALDO FINAL DA CONTA CONTÁBIL QUE REGISTRA O ITEM|N|19|2|11| | ||
|I510|IND_SLD_ITEM_FIN|INDICADOR DO SALDO FINAL|C|1||11| | ||
|I510|SLD_SCNT_INI|SALDO INICIAL DA SUBCONTA REPRESENTATIVA DO ITEM|N|19|2|11| | ||
|I510|IND_SLD_SCNT_INI|INDICADOR DO SALDO INICIAL|C|1||11| | ||
|I510|DEB_SCNT|VALOR REGISTRADO A DEBITO NA SUBCONTA|N|19|2|11| | ||
|I510|CRED_SCNT|VALOR REGISTRADO A CREDITO NA SUBCONTA|N|19|2|11| | ||
|I510|SLD_SCNT_FIN|SALDO FINAL DA SUBCONTA REPRESENTATIVA DO ITEM|N|19|2|11| | ||
|I510|IND_SLD_SCNT_FIN|INDICADOR DO SALDO FINAL|C|1||11| | ||
|I510|DATA_LCTO|DATA DO LANÇAMENTO CONTÁBIL|C|8||11| | ||
|I510|NR_LCTO|IDENTIFICAÇÃO DO LANÇAMENTO|C|20||11| | ||
|I510|VLR_LCTO|VALOR DO LANÇAMENTO|N|19|2|11| | ||
|I510|IND_VLR_LCTO|INDICADOR DO VALOR DO LANÇAMENTO|C|1||11| | ||
|I510|IND_ADOC_INI|INDICADOR DA ADOÇÃOO INICIAL|C|1||11| | ||
|I550|70|1.01.01.01|||AA|1|MATRC CARTORIO AA|TERRENO RUA AA|01042019|100000,00|D|0|D|100000,00|D|0|D|10000,00|0|10000,00|D|15012021|AV700|10000,00|D|2| | ||
|I550|70|1.01.01.01|X77||BB|1|MATRC CARTORIO AB|TERRENO RUA BB|02062019|80000,00|D|0|D|80000,00|D|0|D|0|10000,00|10000,00|C|15012021|AV701|10000,00|C|2| | ||
|I550|70|1.01.01.01|X77||BB|1|MATRC CARTORIO AB|TERRENO RUA BB|02062019|80000,00|D|0|D|80000,00|D|10000,00|C|0|40000,00|50000,00|C|18012021|AV810|43000,00|C|2| | ||
|I550|70|1.01.01.01|||CC|1|MATRC CARTORIO AC|TERRENO RUA CC|02012019|30000,00|D|0|D|30000,00|D|0|C|0|3000,00|3000,00|C|18012021|AV810|43000,00|C|2| | ||
|I550|70|1.01.01.01|X77||BB|1|MATRC CARTORIO AB|TERRENO RUA BB|02062019|80000,00|D|0|D|80000,00|D|50000,00|C|50000,00|0|0|C|22012021|AV990|50000,00|D|2| | ||
|I555|70|1.01.01.01|||AA|1|MATRIC CARTORIO AA|TERRENO RUA AA|01042019|100000,00|D|0|D|100000,00|D|0|D|10000,00|0|10000,00|D|||||| | ||
|I555|70|1.01.01.01|X77||BB|0|MATRIC CARTORIO AB|TERRENO RUA AB|02062019|80000,00|D|0|D|80000,00|D|0|C|50000,00|50000,00|0|C|||||| | ||
|I555|70|1.01.01.01|||CC|1|MATRIC CARTORIO AC|TERRENO RUA AC|02012019|30000,00|D|0|D|30000,00|D|0|D|0|3000,00|3000,00|C|||||| | ||
|I550|76|1.05.05.05|12||602B|1|MODELO 16K NR SERIE 7680096|TORNO MECÂNICO|12012020|0|C|0|C|12000,00|C|0|D|2000,00|0|2000,00|D|31122021|LC210|7000,00|D|2| | ||
|I550|76|1.05.05.05|12||603B|1|MODELO 13C NR SERIE 2342536|TORNO MECÂNICO|14012020|20000,00|C|0|C|40000,00|C|5000,00|D|5000,00|0|10000,00|D|31122021|LC210|7000,00|D|2| | ||
|I555|76|1.05.05.05|12||602B|1|MODELO 16K NR SERIE 7680096|TORNO MECÂNICO|12012020|0|C|0|C|12000,00|C|0|D|2000,00|0|2000,00|D|||||| | ||
|I555|76|1.05.05.05|12||603B|1|MODELO 13C NR SERIE 2342536|TORNO MECÂNICO|14012020|20000,00|C|0|C|40000,00|C|5000,00|D|5000,00|0|10000,00|D|||||| | ||
|I550|60|1.07.07.07|12|77777777000191|123456|20000|NELORE MACHO ATÉ 12 MESES|BOVINO PARA ABATE|13122018|0|D|0|D|2000000,00|D|0|D|1200000,00|0|1200000,00|D|31102021|XV500|3000000,00|C|2| | ||
|I550|60|1.07.07.07|12|77777777000191|123456|35000|NELORE FÊMEA 25/36 MESES|BOVINO PARA ABATE|13122018|0|D|0|D|7000000,00|D|0|D|0|4200000,00|4200000,00|C|31102021|XV500|3000000,00|C|2| | ||
|I550|60|1.07.07.07|12|77777777000191|123456|10000|NELORE MACHO ATÉ 12 MESES|BOVINO PARA ABATE|13122018|2000000,00|D|1000000,00|C|1000000,00|D|1200000,00|D|0|600000,00|600000,00|D|22112021|XV637|600000,00|C|2| | ||
|I555|60|1.07.07.07|12|77777777000191|123456|35000|NELORE FÊMEA 25/36 MESES|BOVINO PARA ABATE|13122018|0|D|0|D|7000000,00|D|0|D|0|4200000,00|4200000,00|C|||||| | ||
|I555|60|1.07.07.07|12|77777777000191|123456|10000|NELORE MACHO ATÉ 12 MESES|BOVINO PARA ABATE|13122018|0|D|1000000,00|C|1000000,00|D|0|D|1200000,00|600000,00|600000,00|D|||||| | ||
|I550|65|1.09.09.09||77777777000191|477BG|1|MATRC 456 - CARTÓRIO XX|GALPÃO INDUSTRIAL - SÃO PAULO/SP|31122018|3000000,00|D|0|D|3000000,00|D|0|D|1000000,00|0|1000000,00|D|04012021|896PR|5000000,00|D|2| | ||
|I550|65|1.09.09.09||77777777000191|500AC|300|ON-EMP. 33.333.333/0001-91|AÇÕES|31122018|12000000,00|D|0|D|12000000,00|D|0|D|4000000,00|0|4000000,00|D|04012021|896PR|5000000,00|D|2| | ||
|I550|65|1.09.09.09||77777777000191|477BG|1|MATRC 456 - CARTÓRIO XX|GALPÃO INDUSTRIAL - SÃO PAULO/SP|31122018|3000000,00|D|240000,00|C|2760000,00|D|1000000,00|D|0|80000,00|920000,00|D|31102021|937PR|80000,00|C|2| | ||
|I550|65|1.09.09.09||77777777000191|500AC|150|ON-EMP. 33.333.333/0001-91|AÇÕES|31122019|12000000,00|D|6000000,00|C|6000000,00|D|4000000,00|D|0|2000000,00|2000000,00|D|31102021|938PR|2000000,00|C|2| | ||
|I550|65|1.09.09.09||77777777000191|500AC|0|ON-EMP. 33.333.333/0001-91|AÇÕES|31122019|6000000,00|D|6000000,00|C|0|D|2000000,00|D|0|2000000,00|0|D|07112021|950PR|2000000,00|C|2| | ||
|I555|65|1.09.09.09||77777777000191|477BG|1|MATRC 456 - CARTÓRIO XX|GALPÃO INDUSTRIAL - SÃO PAULO/SP|31122018|3000000,00|D|240000,00|C|2760000,00|D|0|D|1000000,00|80000,00|920000,00|D|||||| | ||
|I555|65|1.09.09.09||77777777000191|500AC|0|ON-EMP. 33.333.333/0001-91|AÇÕES|31122018|12000000,00|D|12000000,00|C|12000000,00|D|0|D|4000000,00|4000000,00|0|D|||||| | ||
|I990|63| | ||
|J001|0| | ||
|J900|TERMO DE ENCERRAMENTO|1|RAZAO_AUXILIAR_DAS_SUBCONTAS|EMPRESA TESTE LIVRO RAZAO AUXILIAR|99|01012021|31122021| | ||
|J930|FULANO|45422460510|DIRETOR|203|4566|EMAIL|FONE|DF|DF/2018/1|01122018|S| | ||
|J930|BELTRANO|77487527379|CONTADOR|900|78090|EMAIL|FONE|DF|DF/2018/1|01122018|N| | ||
|J990|5| | ||
|9001|0| | ||
|9900|0000|1| | ||
|9900|0001|1| | ||
|9900|0007|1| | ||
|9900|0990|1| | ||
|9900|I001|1| | ||
|9900|I010|1| | ||
|9900|I012|1| | ||
|9900|I015|4| | ||
|9900|I030|1| | ||
|9900|I050|4| | ||
|9900|I510|26| | ||
|9900|I550|15| | ||
|9900|I555|9| | ||
|9900|I990|1| | ||
|9900|J001|1| | ||
|9900|J900|1| | ||
|9900|J930|2| | ||
|9900|J990|1| | ||
|9900|9001|1| | ||
|9900|9900|22| | ||
|9900|9990|1| | ||
|9900|9999|1| | ||
|9990|25| | ||
|9999|97| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
# Copyright 2024 - TODAY, Akretion - Raphael Valyi <[email protected]> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). | ||
# Generated by https://github.com/akretion/sped-extractor and xsdata-odoo | ||
# and simplified manually for tests | ||
# flake8: noqa: B950 | ||
|
||
import textwrap | ||
|
||
from erpbrasil.base import misc | ||
from lxml.builder import E | ||
|
||
from odoo import api, fields, models | ||
|
||
from odoo.addons.l10n_br_sped_base.models.sped_mixin import ( | ||
EDITABLE_ON_DRAFT, | ||
LAYOUT_VERSIONS, | ||
) | ||
|
||
|
||
class Registro0000(models.Model): | ||
"ABERTURA DO ARQUIVO DIGITAL E IDENTIFICAÇÃO DO EMPRESÁRIO OU DA SOCIEDADE EMPRESÁRIA" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.0000" | ||
_inherit = ["l10n_br_sped.fake.9.0000"] | ||
_odoo_model = "res.company" | ||
|
||
IND_SIT_ESP = fields.Selection( | ||
selection=[ | ||
("0", "0 - Abertura"), | ||
("1", "1 - Cisão"), | ||
("2", "2 - Fusão"), | ||
("3", "3 - Incorporação"), | ||
("4", "4 - Extinção"), | ||
("5", "5 - Transformação"), | ||
("6", "6 - Transferência de Sede"), | ||
], | ||
string="Indicador de situação especial", | ||
) | ||
|
||
IND_SIT_INI_PER = fields.Selection( | ||
default="0", | ||
selection=[ | ||
("0", "0 - Normal"), | ||
("1", "1 - Abertura"), | ||
("2", "2 - Cisão/Fusão"), | ||
("3", "3 - Obrigatoriedade no curso do ano"), | ||
], | ||
string="Indicador de situação do inicio do período", | ||
) | ||
|
||
IND_FIN_ESC = fields.Selection( | ||
default="0", | ||
selection=[ | ||
("0", "0 - Original"), | ||
("1", "1 - Substituta da escrituração com NIRE"), | ||
("2", "2 - Substituta da escrituração sem NIRE"), | ||
("3", "3 - Substituta da escrituração com troca de NIRE"), | ||
], | ||
string="Indicador de finalidade da escrituração", | ||
) | ||
|
||
# not a register 0000 field, but used for i010 register | ||
ind_esc = fields.Selection( | ||
selection=[ | ||
("G", "G - Diário completo"), | ||
("R", "R - Escrituração Resumida"), | ||
("A", "A - Auxiliar"), | ||
("B", "B - Diários e Balanços"), | ||
("Z", "Z - Razão Auxiliar"), | ||
], | ||
default="G", | ||
string="Forma de escritura contábil", | ||
) | ||
|
||
@api.model | ||
def _append_top_view_elements(self, group, inline=False): | ||
super()._append_top_view_elements(group) | ||
group.append(E.field(name="ind_esc", required="1", attrs=EDITABLE_ON_DRAFT)) | ||
|
||
@api.model | ||
def _odoo_domain(self, parent_record, declaration): | ||
return [("id", "=", declaration.company_id.id)] | ||
|
||
@api.model | ||
def _map_from_odoo(self, record, parent_record, declaration, index=0): | ||
return { | ||
"LECD": "LECD", | ||
# "DT_INI": (will use the declaration field directly), | ||
# "DT_FIN": (will use the declaration field directly), | ||
"NOME": record.legal_name, | ||
"CNPJ": misc.punctuation_rm(record.cnpj_cpf), | ||
"UF": record.state_id.code, | ||
"IE": misc.punctuation_rm(record.inscr_est), | ||
"COD_MUN": record.city_id.ibge_code, | ||
"IM": misc.punctuation_rm(record.inscr_mun or ""), | ||
# "IND_SIT_ESP": (will use the declaration field directly), | ||
# "IND_SIT_INI_PER": (will use the declaration field directly), | ||
"IND_NIRE": 0, # TODO | ||
# "IND_FIN_ESC" | ||
"COD_HASH_SUB": 0, # TODO | ||
"IND_GRANDE_PORTE": 0, # TODO | ||
"TIP_ECD": 0, # TODO | ||
"COD_SCP": 0, # TODO | ||
"IDENT_MF": 0, # TODO | ||
"IND_ESC_CONS": 0, # TODO | ||
"IND_CENTRALIZADA": 0, # TODO | ||
"IND_MUDANC_PC": 0, # TODO | ||
"COD_PLAN_REF": 0, # TODO | ||
} | ||
|
||
|
||
class Registro0007(models.Model): | ||
"OUTRAS INSCRIÇÕES CADASTRAIS DA PESSOA JURÍDICA" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.0007" | ||
_inherit = "l10n_br_sped.fake.9.0007" | ||
|
||
|
||
class RegistroI010(models.Model): | ||
"IDENTIFICAÇÃO DA ESCRITURAÇÃO CONTÁBIL" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i010" | ||
_inherit = "l10n_br_sped.fake.9.i010" | ||
|
||
IND_ESC = fields.Selection(related="declaration_id.ind_esc", readonly=False) | ||
|
||
@api.model | ||
def _map_from_odoo(self, record, parent_record, declaration, index=0): | ||
return { | ||
"COD_VER_LC": LAYOUT_VERSIONS["ecd"], | ||
} | ||
|
||
|
||
class RegistroI012(models.Model): | ||
"LIVROS AUXILIARES AO DIÁRIO" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i012" | ||
_inherit = "l10n_br_sped.fake.9.i012" | ||
|
||
|
||
class RegistroI015(models.Model): | ||
"""IDENTIFICAÇÃO DAS CONTAS DA ESCRITURAÇÃO RESUMIDA A QUE SE REFERE A | ||
ESCRITURAÇÃO AUXILIAR""" | ||
|
||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i015" | ||
_inherit = "l10n_br_sped.fake.9.i015" | ||
|
||
|
||
class RegistroI030(models.Model): | ||
"TERMO DE ABERTURA" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i030" | ||
_inherit = "l10n_br_sped.fake.9.i030" | ||
|
||
|
||
class RegistroI050(models.Model): | ||
"PLANO DE CONTAS" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i050" | ||
_inherit = "l10n_br_sped.fake.9.i050" | ||
|
||
|
||
class RegistroI510(models.Model): | ||
"""DEFINIÇÃO DOS CAMPOS DO LIVRO RAZÃO AUXILIAR COM LEIAUTE | ||
PARAMETRIZÁVEL""" | ||
|
||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i510" | ||
_inherit = "l10n_br_sped.fake.9.i510" | ||
|
||
|
||
class RegistroI550(models.Model): | ||
"DETALHES DO LIVRO RAZÃO AUXILIAR COM LEIAUTE PARAMETRIZÁVEL" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i550" | ||
_inherit = "l10n_br_sped.fake.9.i550" | ||
|
||
RZ_CONT = fields.Char() # according to pdf specification | ||
|
||
@api.model | ||
def _read_register_line(self, line, version): | ||
vals = {"RZ_CONT": "|".join(line.split("|")[2:][:-1])} | ||
return vals | ||
|
||
def _generate_register_text(self, sped, version, line_count, count_by_register): | ||
code = self._name[-4:].upper() | ||
if len(self): | ||
count_by_register[code] += len(self) | ||
for rec in self: | ||
sped.write("\n|%s|" % (code,)) | ||
sped.write(rec.RZ_CONT) | ||
sped.write("|") | ||
line_count[0] += 1 | ||
rec.reg_I555_ids._generate_register_text( | ||
sped, version, line_count, count_by_register | ||
) | ||
return sped | ||
|
||
|
||
class RegistroI555(models.Model): | ||
"TOTAIS NO LIVRO RAZÃO AUXILIAR COM LEIAUTE PARAMETRIZÁVEL" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.i555" | ||
_inherit = "l10n_br_sped.fake.9.i555" | ||
|
||
RZ_CONT_TOT = fields.Char() # according to pdf specification | ||
|
||
@api.model | ||
def _read_register_line(self, line, version): | ||
vals = {"RZ_CONT_TOT": "|".join(line.split("|")[2:][:-1])} | ||
return vals | ||
|
||
def _generate_register_text(self, sped, version, line_count, count_by_register): | ||
code = self._name[-4:].upper() | ||
if len(self): | ||
count_by_register[code] += len(self) | ||
for rec in self: | ||
sped.write("\n|%s|" % (code,)) | ||
sped.write(rec.RZ_CONT_TOT or "") | ||
sped.write("|") | ||
line_count[0] += 1 | ||
|
||
|
||
class RegistroJ900(models.Model): | ||
"TERMO DE ENCERRAMENTO" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.j900" | ||
_inherit = "l10n_br_sped.fake.9.j900" | ||
|
||
|
||
class RegistroJ930(models.Model): | ||
"SIGNATÁRIOS DA ESCRITURAÇÃO" | ||
_description = textwrap.dedent(" %s" % (__doc__,)) | ||
_name = "l10n_br_sped.fake.j930" | ||
_inherit = "l10n_br_sped.fake.9.j930" |
Oops, something went wrong.