Skip to content

Commit

Permalink
Merge PR #3271 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by rvalyi
  • Loading branch information
OCA-git-bot committed Aug 9, 2024
2 parents 0f73422 + 0415d8f commit 1f08910
Show file tree
Hide file tree
Showing 31 changed files with 1,999 additions and 0 deletions.
1 change: 1 addition & 0 deletions l10n_br_account/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def setUpClass(cls, chart_template_ref=None):
"taxes_id": False,
"tax_icms_or_issqn": "icms",
"uoe_id": cls.env.ref("uom.product_uom_kgm").id,
"default_code": "PRODUCT_B",
}
)
cls.fiscal_type_product_product_b = cls.env["ir.property"].create(
Expand Down
139 changes: 139 additions & 0 deletions l10n_br_account_nfe/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
=============================
Account NFe/NFC-e Integration
=============================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:e13f8f0153ea0f7311fe4f10f09547648467a34650d59726ad92e3753ebd8bfe
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fl10n--brazil-lightgray.png?logo=github
:target: https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_account_nfe
:alt: OCA/l10n-brazil
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/l10n-brazil-14-0/l10n-brazil-14-0-l10n_br_account_nfe
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/l10n-brazil&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

**Português**
Este módulo integra os módulos l10n_br_account e l10n_br_nfe.

* Adicionando as informações de Pagamento e Duplicatas da Fatura, TAGs cobr, pag e dup da NF-e/NFC-e.

**English**
This module integrates the l10n_br_account and l10n_br_nfe modules.

* Adding Payment Information and Invoice Duplicates, TAGs cobr, pag and dup of NF-e/NFC-e.

**Table of contents**

.. contents::
:local:

Configuration
=============

**Português**
Crie o Modo de Pagamento e informe o campo Meio de Pagamento da NF:
Faturamento > Configuração > Administração > Modos de Pagamento

**English**
Create the Payment Mode and inform the field Meio de Pagamento da NF:
Invoicing > Configuration > Management > Payment Modes

Usage
=====

**Português**
Ao Confirmar um Documento Fiscal do tipo NFe ou NFCe, os dados das Tags de Pagamento e Duplicatas serão criados automaticamente.

**English**
When Confirming a NFe or NFCe Fiscal Document, the Payment Tags and Duplicates data will be created automatically.

Known issues / Roadmap
======================

* Existe a possibilidade de criar uma Nota Fiscal com múltiplos Modos/Meio de Pagamentos RFC https://github.com/OCA/l10n-brazil/issues/1850

Changelog
=========

12.0.1.0.0 (2022-03-30)
~~~~~~~~~~~~~~~~~~~~~~~

* [NEW] Primeira versão

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/l10n-brazil/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/l10n-brazil/issues/new?body=module:%20l10n_br_account_nfe%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Engenere
* Akretion

Contributors
~~~~~~~~~~~~

* `Engenere <https://engenere.one>`_:

* Felipe Motter Pereira <felipe@engenere.one>
* Antônio S. Pereira Neto <neto@engenere.one>

* `Akretion <https://akretion.com/pt-BR>`_:

* Magno Barcelo da Costa <magno.costa@akretion.com.br>

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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-antoniospneto| image:: https://github.com/antoniospneto.png?size=40px
:target: https://github.com/antoniospneto
:alt: antoniospneto
.. |maintainer-felipemotter| image:: https://github.com/felipemotter.png?size=40px
:target: https://github.com/felipemotter
:alt: felipemotter
.. |maintainer-mbcosta| image:: https://github.com/mbcosta.png?size=40px
:target: https://github.com/mbcosta
:alt: mbcosta

Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-antoniospneto| |maintainer-felipemotter| |maintainer-mbcosta|

This module is part of the `OCA/l10n-brazil <https://github.com/OCA/l10n-brazil/tree/14.0/l10n_br_account_nfe>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 4 additions & 0 deletions l10n_br_account_nfe/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .hooks import post_init_hook

from . import models
from . import report
30 changes: 30 additions & 0 deletions l10n_br_account_nfe/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2022-Today - Engenere (<https://engenere.one>).
# @author Antônio S. Pereira Neto <neto@engenere.one>
# @author Felipe Motter Pereira <felipe@engenere.one>
# Copyright (C) 2022-Today - Akretion (<https://akretion.com/pt-BR>).
# @author Magno Costa <magno.costa@akretion.com.br>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Account NFe/NFC-e Integration",
"summary": "Integration between l10n_br_account and l10n_br_nfe",
"category": "Localisation",
"license": "AGPL-3",
"author": "Engenere," "Akretion," "Odoo Community Association (OCA)",
"maintainers": ["antoniospneto", "felipemotter", "mbcosta"],
"website": "https://github.com/OCA/l10n-brazil",
"version": "15.0.1.0.0",
"development_status": "Beta",
"depends": [
"l10n_br_nfe",
"l10n_br_account",
"account_payment_partner",
],
"data": [
"views/account_payment_mode.xml",
"report/danfe_report.xml",
],
"post_init_hook": "post_init_hook",
"installable": True,
"auto_install": True,
}
113 changes: 113 additions & 0 deletions l10n_br_account_nfe/demo/account_invoice_sn_demo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!--
** Attention **
This file is loaded by hooks with defualt user company "Simples Nacional"
This is important to maintain multi-company data consistency.
Do not include data from another company here,
if necessary, do it in a separate file.
-->
<!-- Payment Terms -->
<record id="account_payment_term_30_60_90" model="account.payment.term">
<field name="name">30/60/90</field>
<field name="note">Payment terms: 30/60/90</field>
<field name="company_id" ref="l10n_br_base.empresa_simples_nacional" />
<field
name="line_ids"
eval="[(5, 0),
(0, 0, {'value': 'percent', 'value_amount': 33, 'sequence': 500, 'days': 30, 'option': 'day_after_invoice_date'}),
(0, 0, {'value': 'percent', 'value_amount': 33, 'sequence': 500, 'days': 60, 'option': 'day_after_invoice_date'}),
(0, 0, {'value': 'balance', 'value_amount': 0.0, 'sequence': 500, 'days': 90, 'option': 'day_after_invoice_date'})
]"
/>
</record>

<!-- Account Journal for Simples Nacional -->
<record id="demo_simples_nacional_bank_journal" model="account.journal">
<field name="name">Diário de Boleto - Simples Nacional</field>
<field name="code">TPO</field>
<field name="type">bank</field>
<field name="company_id" ref="l10n_br_base.empresa_simples_nacional" />
</record>

<!-- Payment Mode -->
<record id="demo_payment_mode_boleto" model="account.payment.mode">
<field name="name">Boleto</field>
<field name="company_id" ref="l10n_br_base.empresa_simples_nacional" />
<field
name="payment_method_id"
ref="account.account_payment_method_manual_in"
/>
<field name="fiscal_payment_mode">15</field>
<field name="bank_account_link">fixed</field>
<field name="fixed_journal_id" ref="demo_simples_nacional_bank_journal" />
</record>

<!-- Faturas/Invoices de Teste deve gerar TAG Cobrança -->
<record id="demo_nfe_dados_de_cobranca" model="account.move">
<field name="name">Teste NFe Dados de Cobrança</field>
<field name="company_id" ref="l10n_br_base.empresa_simples_nacional" />
<field name="invoice_payment_term_id" ref="account_payment_term_30_60_90" />
<field name="partner_id" ref="l10n_br_base.res_partner_akretion" />
<field name="move_type">out_invoice</field>
<field name="invoice_user_id" ref="base.user_admin" />
<field name="payment_mode_id" ref="demo_payment_mode_boleto" />
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda" />
<field name="document_type_id" ref="l10n_br_fiscal.document_55" />
<field
name="document_serie_id"
ref="l10n_br_fiscal.empresa_sn_document_55_serie_1"
/>
<field name="document_serie">1</field>
<field
name="invoice_line_ids"
eval="[
(0, 0, {
'product_id': ref('product.product_product_5'),
'quantity': 1,
'price_unit': 1000,
'company_id': ref('l10n_br_base.empresa_simples_nacional'),
'partner_id': ref('l10n_br_base.res_partner_akretion'),
'uom_id': ref('uom.product_uom_unit'),
'fiscal_operation_id': ref('l10n_br_fiscal.fo_venda'),
'fiscal_operation_line_id': ref('l10n_br_fiscal.fo_venda_revenda_nao_contribuinte'),
'cfop_id': ref('l10n_br_fiscal.cfop_5102'),
'ncm_id': ref('l10n_br_fiscal.ncm_84714900'),
})]"
/>
</record>

<!-- Faturas/Invoices de Teste não deve gerar TAG Cobrança -->
<record id="demo_nfe_sem_dados_de_cobranca" model="account.move">
<field name="name">Teste NFe Sem Dados de Cobrança</field>
<field name="company_id" ref="l10n_br_base.empresa_simples_nacional" />
<field name="partner_id" ref="l10n_br_base.res_partner_akretion" />
<field name="move_type">out_invoice</field>
<field name="user_id" ref="base.user_admin" />
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_bonificacao" />
<field name="document_type_id" ref="l10n_br_fiscal.document_55" />
<field
name="document_serie_id"
ref="l10n_br_fiscal.empresa_sn_document_55_serie_1"
/>
<field name="document_serie">1</field>
<field name="fiscal_operation_type">out</field>
<field
name="invoice_line_ids"
eval="[
(0, 0, {
'product_id': ref('product.product_product_5'),
'quantity': 1,
'price_unit': 1000,
'company_id': ref('l10n_br_base.empresa_simples_nacional'),
'partner_id': ref('l10n_br_base.res_partner_akretion'),
'uom_id': ref('uom.product_uom_unit'),
'fiscal_operation_id': ref('l10n_br_fiscal.fo_bonificacao'),
'fiscal_operation_line_id': ref('l10n_br_fiscal.fo_bonificacao_bonificacao'),
'cfop_id': ref('l10n_br_fiscal.cfop_5910'),
'ncm_id': ref('l10n_br_fiscal.ncm_84714900'),
})]"
/>
</record>

</odoo>
55 changes: 55 additions & 0 deletions l10n_br_account_nfe/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (C) 2022-Today - Engenere (<https://engenere.one>).
# @author Antônio S. Pereira Neto <neto@engenere.one>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import SUPERUSER_ID, api, tools


def post_init_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
load_simples_nacional_demo(env, registry)


def load_simples_nacional_demo(env, registry):
"""
Load demo data for company 'Simples Nacional' with
default user company set to this company.
"""

# Load XML file with demo data.
company_sn = env.ref(
"l10n_br_base.empresa_simples_nacional", raise_if_not_found=False
)
if company_sn:
# Allow all companies for OdooBot user and set default user company
companies = env["res.company"].search([])
env.user.company_ids = [(6, 0, companies.ids)]
env.user.company_id = company_sn

tools.convert_file(
env.cr,
"l10n_br_account_nfe",
"demo/account_invoice_sn_demo.xml",
None,
mode="init",
noupdate=True,
kind="demo",
)

# É necessário rodar os onchanges fiscais para
# preencher os campos referentes aos Impostos
invoice_tag_cobranca = env.ref("l10n_br_account_nfe.demo_nfe_dados_de_cobranca")
for line in invoice_tag_cobranca.invoice_line_ids:
line._onchange_fiscal_operation_line_id()
line._onchange_fiscal_tax_ids()

invoice_sem_tag_cobranca = env.ref(
"l10n_br_account_nfe.demo_nfe_sem_dados_de_cobranca"
)
for line in invoice_sem_tag_cobranca.invoice_line_ids:
line._onchange_fiscal_operation_line_id()
line._onchange_fiscal_tax_ids()

# back to the main company as the next modules to be installed
# expect this to be the default company.
env.user.company_id = env.ref("base.main_company")
Loading

0 comments on commit 1f08910

Please sign in to comment.