Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] l10n_br_account_nfe: improve tests #222

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 8 additions & 43 deletions l10n_br_account_nfe/tests/test_nfe_generate_tags_cobr_dup_pag.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,53 +82,18 @@ def setUpClass(cls):
cls.fiscal_operation_id.deductible_taxes = True

move_form = Form(
cls.env["account.move"]
.with_company(cls.company)
.with_context(default_move_type="out_invoice")
cls.env["account.move"].with_context(default_move_type="out_invoice")
)
move_form.partner_id = cls.env.ref("l10n_br_base.res_partner_cliente1_sp")
move_form.document_type_id = cls.env.ref("l10n_br_fiscal.document_55")
move_form.fiscal_operation_id = cls.fiscal_operation_id
invoice_vals = move_form._values_to_save(all_fields=True)
invoice_vals.update(
{
"company_id": cls.company.id,
"currency_id": cls.company.currency_id.id,
"payment_mode_id": cls.payment_mode.id,
"document_serie_id": cls.env.ref(
"l10n_br_fiscal.empresa_lc_document_55_serie_1"
).id,
"journal_id": cls.invoice_journal.id,
"invoice_payment_term_id": cls.payment_term.id,
"invoice_origin": "Teste l10n_br_account_nfe",
"invoice_user_id": cls.env.user.id,
}
)

line_form = move_form.invoice_line_ids.new()
line_form.product_id = cls.env.ref("product.product_product_7")
line_form.fiscal_operation_id = cls.fiscal_operation_id
invoice_line_vals = line_form._values_to_save(all_fields=True)
invoice_line_vals.update(
{
"account_id": cls.invoice_line_account_id.id,
"quantity": 1,
"product_uom_id": cls.env.ref("uom.product_uom_unit").id,
"price_unit": 450.0,
"name": "Product - Invoice Line Test",
"fiscal_operation_line_id": cls.env.ref(
"l10n_br_fiscal.fo_venda_revenda"
).id,
"company_id": cls.company.id,
"partner_id": cls.env.ref("l10n_br_base.res_partner_cliente1_sp").id,
}
)

invoice_vals["invoice_line_ids"].append((0, 0, invoice_line_vals))
cls.invoice = cls.env["account.move"].create(invoice_vals)
cls.invoice.invoice_line_ids._onchange_fiscal_tax_ids()
cls.invoice.invoice_line_ids._onchange_fiscal_operation_line_id()
cls.invoice.action_post()
move_form.payment_mode_id = cls.payment_mode
move_form.invoice_payment_term_id = cls.payment_term
with move_form.invoice_line_ids.new() as line_form:
line_form.product_id = cls.env.ref("product.product_product_7")
line_form.price_unit = 450.0
cls.invoice = move_form.save()
cls.invoice._post()

# Dado de Demonstração
cls.invoice_demo_data = cls.env.ref(
Expand Down
Loading