Skip to content

Commit

Permalink
[IMP] l10n_br_account_nfe: add credit note SN test case
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoParadeda committed Dec 5, 2024
1 parent 0b67cf5 commit c0c5714
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
34 changes: 34 additions & 0 deletions l10n_br_account_nfe/demo/account_invoice_sn_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,38 @@
/>
</record>

<!-- Nota de Crédito -->
<record id="demo_nfe_nota_de_credito" model="account.move">
<field name="name">Teste NFe Nota de Crédito</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_refund</field>
<field name="invoice_user_id" ref="base.user_admin" />
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_devolucao_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_devolucao_venda'),
'fiscal_operation_line_id': ref('l10n_br_fiscal.fo_devolucao_revenda_devolucao_revenda'),
'cfop_id': ref('l10n_br_fiscal.cfop_5102'),
'ncm_id': ref('l10n_br_fiscal.ncm_84714900'),
'p_devol': 50,
'ipi_devol_value': 1,
})]"
/>
</record>

</odoo>
7 changes: 7 additions & 0 deletions l10n_br_account_nfe/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ def load_simples_nacional_demo(env, registry):
line._onchange_fiscal_operation_line_id()
line._onchange_fiscal_tax_ids()

invoice_nota_de_credito = env.ref(
"l10n_br_account_nfe.demo_nfe_nota_de_credito"
)
for line in invoice_nota_de_credito.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")

0 comments on commit c0c5714

Please sign in to comment.