From 124bad623725dd2173b223e51ba9712151bf4f23 Mon Sep 17 00:00:00 2001 From: Wesley Oliveira Date: Mon, 10 Mar 2025 14:52:59 -0300 Subject: [PATCH 1/2] [IMP] l10n_br_sped_efd_icms_ipi: pre-commit stuff --- l10n_br_sped_efd_icms_ipi/README.rst | 39 +++++++++-- .../models/sped_efd_icms_ipi.py | 27 ++++---- .../static/description/index.html | 65 +++++++++++++------ 3 files changed, 88 insertions(+), 43 deletions(-) diff --git a/l10n_br_sped_efd_icms_ipi/README.rst b/l10n_br_sped_efd_icms_ipi/README.rst index a84ef52e8830..24efa4f2629e 100644 --- a/l10n_br_sped_efd_icms_ipi/README.rst +++ b/l10n_br_sped_efd_icms_ipi/README.rst @@ -7,7 +7,7 @@ SPED - EFD ICMS IPI !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:da8644dc46b3804bb2fe18147e5b0e5481b1b48b135bb30ea993ed7e104f095b + !! source digest: sha256:5c90c680fdf839a66bd2ea323af60b071ce814c0d7a0667d85932c230f245edd !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png @@ -28,7 +28,24 @@ SPED - EFD ICMS IPI |badge1| |badge2| |badge3| |badge4| |badge5| -TODO +Arquivo EFD ICMS/IPI do SPED / SPED Fiscal +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Este módulo contém toda a estrutura dos registros da ECF ICMS/IPI do SPED. +Ou seja se vocẽ preencher todos registros do SPED, o arquivo digital vai sair certinho. +**Porem o mapeamento dos dados a partir das transações do Odoo é um trabalho parcial +e em andamento**. Foi colocado o módulo no repo da localização para facilitar as contribuições +mas é importante vocẽ homologar bem até que ponto os mapeamentos atuais atendem você. + +A ideia é começar pelos mapeamentos das transações mais intensivas e mais comum +para facilitar a geração dos blocos relevantes do SPED e completar o arquivo +do SPED manualmente (dentro do Odoo, dentro do validador gratuito ou dentro +de um software especializado) ou deixar um escritório de contabilidade fazê-lo. +É possível também importar arquivos de SPED para completar o que o ainda +não teria sido possível mapear a partir do Odoo. + +Vocẽ pode se referir a documentação do módulo l10n_br_sped_base para ver como +O sistema de mapeamento funciona. .. IMPORTANT:: This is an alpha version, the data model and design can change at any time without warning. @@ -40,6 +57,13 @@ TODO .. contents:: :local: +Usage +===== + +1. Entre no menu SPED>ECD ICMS IPI e crie uma Declaração do SPED para a empresa e o período desejado. Preencher os dados (se trata dos dados do registro 0000 na verdade) +2. clique no botão "Puxar os registros do Odoo" para popular os registros do SPED. +3. Finalmente, clique no botão "Gerar arquivo do SPED" e baixe o arquivo que foi adicionado no chatter. Vocẽ pode transmitir o arquivo com o validador gratuito da receita por exemplo. + Bug Tracker =========== @@ -67,6 +91,9 @@ Contributors * Renato Lima * Clement Monbereau +* `ATS Soluções Empresariais `_: + + * Carlos Silveira Maintainers ~~~~~~~~~~~ @@ -81,16 +108,16 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -.. |maintainer-renatonlima| image:: https://github.com/renatonlima.png?size=40px - :target: https://github.com/renatonlima - :alt: renatonlima .. |maintainer-rvalyi| image:: https://github.com/rvalyi.png?size=40px :target: https://github.com/rvalyi :alt: rvalyi +.. |maintainer-renatonlima| image:: https://github.com/renatonlima.png?size=40px + :target: https://github.com/renatonlima + :alt: renatonlima Current `maintainers `__: -|maintainer-renatonlima| |maintainer-rvalyi| +|maintainer-rvalyi| |maintainer-renatonlima| This module is part of the `OCA/l10n-brazil `_ project on GitHub. diff --git a/l10n_br_sped_efd_icms_ipi/models/sped_efd_icms_ipi.py b/l10n_br_sped_efd_icms_ipi/models/sped_efd_icms_ipi.py index ffc088403fe4..739532cbf2cb 100644 --- a/l10n_br_sped_efd_icms_ipi/models/sped_efd_icms_ipi.py +++ b/l10n_br_sped_efd_icms_ipi/models/sped_efd_icms_ipi.py @@ -4,6 +4,7 @@ # flake8: noqa: B950 import textwrap +from datetime import datetime from erpbrasil.base import misc from lxml.builder import E @@ -11,10 +12,6 @@ from odoo import api, fields, models from odoo.exceptions import UserError -from datetime import datetime, timedelta -import pytz -import base64 - from odoo.addons.l10n_br_sped_base.models.sped_mixin import LAYOUT_VERSIONS @@ -3687,11 +3684,10 @@ class RegistroH005(models.Model): @api.model def _map_from_odoo(self, record, parent_record, declaration, index=0): - to_date = '%s 23:59:00' %(datetime.strftime( - declaration.DT_FIN, '%Y-%m-%d')) + to_date = "%s 23:59:00" % (datetime.strftime(declaration.DT_FIN, "%Y-%m-%d")) context = dict(self.env.context, to_date=to_date) - product = self.env['product.product'].with_context(context) - records = product.search([('qty_available','>', 0)]) + product = self.env["product.product"].with_context(context) + records = product.search([("qty_available", ">", 0)]) inventory_amount = 0.0 for record in records: inventory_amount += record.qty_available * record.standard_price @@ -3711,11 +3707,10 @@ class RegistroH010(models.Model): @api.model def _odoo_domain(self, parent_record, declaration): - to_date = '%s 23:59:00' %(datetime.strftime( - declaration.DT_FIN, '%Y-%m-%d')) + to_date = "%s 23:59:00" % (datetime.strftime(declaration.DT_FIN, "%Y-%m-%d")) context = dict(self.env.context, to_date=to_date) - product = self.env['product.product'].with_context(context) - records = product.search([('qty_available','>', 0)]) + product = self.env["product.product"].with_context(context) + records = product.search([("qty_available", ">", 0)]) return [ ("id", "in", records.ids), ] @@ -3735,6 +3730,7 @@ def _map_from_odoo(self, record, parent_record, declaration, index=0): "VL_ITEM_IR": 0, # Valor do item para efeitos do Imposto de Renda. } + class RegistroH020(models.Model): "Informação complementar do Inventário" _description = textwrap.dedent(" %s" % (__doc__,)) @@ -3789,11 +3785,10 @@ class RegistroK200(models.Model): @api.model def _odoo_domain(self, parent_record, declaration): - to_date = '%s 23:59:00' %(datetime.strftime( - declaration.DT_FIN, '%Y-%m-%d')) + to_date = "%s 23:59:00" % (datetime.strftime(declaration.DT_FIN, "%Y-%m-%d")) context = dict(self.env.context, to_date=to_date) - product = self.env['product.product'].with_context(context) - records = product.search([('qty_available','>', 0)]) + product = self.env["product.product"].with_context(context) + records = product.search([("qty_available", ">", 0)]) return [ ("id", "in", records.ids), ] diff --git a/l10n_br_sped_efd_icms_ipi/static/description/index.html b/l10n_br_sped_efd_icms_ipi/static/description/index.html index 516d7e39b0a0..0db12cab7546 100644 --- a/l10n_br_sped_efd_icms_ipi/static/description/index.html +++ b/l10n_br_sped_efd_icms_ipi/static/description/index.html @@ -1,20 +1,20 @@ - + - + SPED - EFD ICMS IPI