Skip to content

Commit

Permalink
[REF] l10n_br_account: simples nacional taxes
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniospneto committed Dec 8, 2023
1 parent 07927db commit a622272
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 15 deletions.
1 change: 0 additions & 1 deletion l10n_br_account/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ def _compute_taxes_mapped(self, base_line):
fiscal_price=base_line.fiscal_price,
fiscal_quantity=base_line.fiscal_quantity,
uot_id=base_line.uot_id,
icmssn_range=base_line.icmssn_range_id,
icms_origin=base_line.icms_origin,
ind_final=base_line.ind_final,
)
Expand Down
3 changes: 1 addition & 2 deletions l10n_br_account/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ def _get_price_total_and_subtotal(
fiscal_price=self.fiscal_price,
fiscal_quantity=self.fiscal_quantity,
uot_id=self.uot_id,
icmssn_range=self.icmssn_range_id,
cfop=self.cfop_id,
icms_origin=self.icms_origin,
ind_final=self.ind_final,
),
Expand Down Expand Up @@ -436,7 +436,6 @@ def _get_price_total_and_subtotal_model(
fiscal_price=self.env.context.get("fiscal_price"),
fiscal_quantity=self.env.context.get("fiscal_quantity"),
uot_id=self.env.context.get("uot_id"),
icmssn_range=self.env.context.get("icmssn_range"),
icms_origin=self.env.context.get("icms_origin"),
ind_final=self.env.context.get("ind_final"),
)
Expand Down
2 changes: 0 additions & 2 deletions l10n_br_account/models/account_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def compute_all(
fiscal_price=None,
fiscal_quantity=None,
uot_id=None,
icmssn_range=None,
icms_origin=None,
ind_final=FINAL_CUSTOMER_NO,
):
Expand Down Expand Up @@ -114,7 +113,6 @@ def compute_all(
ii_customhouse_charges=ii_customhouse_charges,
freight_value=freight_value,
operation_line=operation_line,
icmssn_range=icmssn_range,
icms_origin=icms_origin or product.icms_origin,
ind_final=ind_final,
)
Expand Down
31 changes: 21 additions & 10 deletions l10n_br_account/tests/test_account_move_sn.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copyright 2023 - TODAY Akretion - Raphael Valyi <raphael.valyi@akretion.com>
# Copyright 2023 Engenere - Antônio S. Pereira Neto <neto@engenere.one>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields
Expand Down Expand Up @@ -77,13 +78,23 @@ def setup_company_data(cls, company_name, chart_template=None, **kwargs):
return res

def test_company_sn_config(self):
self.assertEqual(
self.company_data["company"].simplified_tax_id.name, "Anexo 2 - Indústria"
company_sn = self.company_data["company"]
# Imposto quando é venda de fabricação própria (Venda)
industry_sn_taxes = company_sn.sn_effective_tax_ids.filtered(
lambda t: t.simplified_tax_id.name == "Anexo 2 - Indústria"
)
self.assertEqual(self.company_data["company"].simplified_tax_percent, 8.44)
self.assertEqual(
self.company_data["company"].simplified_tax_range_id.name, "Faixa 4"
self.assertAlmostEqual(industry_sn_taxes.current_effective_tax, 8.44, places=2)
self.assertEqual(industry_sn_taxes.current_range_id.name, "Faixa 4")
self.assertAlmostEqual(industry_sn_taxes.tax_icms_percent, 2.70, places=2)
self.assertAlmostEqual(company_sn.icmssn_credit_industry, 2.70, places=2)
# Impostos quando é comercialização (Revenda)
commerce_sn_taxes = company_sn.sn_effective_tax_ids.filtered(
lambda t: t.simplified_tax_id.name == "Anexo 1 - Comércio"
)
self.assertAlmostEqual(commerce_sn_taxes.current_effective_tax, 7.94, places=2)
self.assertEqual(commerce_sn_taxes.current_range_id.name, "Faixa 4")
self.assertAlmostEqual(commerce_sn_taxes.tax_icms_percent, 2.66, places=2)
self.assertAlmostEqual(company_sn.icmssn_credit_commerce, 2.66, places=2)

def test_revenda_fiscal_lines(self):
self.assertEqual(
Expand All @@ -98,7 +109,7 @@ def test_revenda_fiscal_lines(self):
self.move_out_revenda.invoice_line_ids[0].icms_cst_id,
self.env.ref("l10n_br_fiscal.cst_icmssn_101"),
)
self.assertEqual(self.move_out_revenda.invoice_line_ids[0].icmssn_percent, 2.70)
self.assertEqual(self.move_out_revenda.invoice_line_ids[0].icmssn_percent, 2.66)

def test_revenda(self):
product_line_vals_1 = {
Expand All @@ -114,9 +125,9 @@ def test_revenda(self):
"price_total": 1000.0,
"tax_line_id": False,
"currency_id": self.company_data["currency"].id,
"amount_currency": -973.0,
"amount_currency": -973.4,
"debit": 0.0,
"credit": 973.0,
"credit": 973.4,
"date_maturity": False,
"tax_exigible": True,
}
Expand All @@ -139,9 +150,9 @@ def test_revenda(self):
.search([("name", "=", "ICMS SN Saida")], order="id DESC", limit=1)
.id,
"currency_id": self.company_data["currency"].id,
"amount_currency": -27.0,
"amount_currency": -26.6,
"debit": 0.0,
"credit": 27.0,
"credit": 26.6,
"date_maturity": False,
"tax_exigible": True,
}
Expand Down

0 comments on commit a622272

Please sign in to comment.