diff --git a/l10n_br_fiscal/data/operation_data.xml b/l10n_br_fiscal/data/operation_data.xml
index 04464ba5c5be..3fd4320ba7ed 100644
--- a/l10n_br_fiscal/data/operation_data.xml
+++ b/l10n_br_fiscal/data/operation_data.xml
@@ -61,6 +61,9 @@
approved
00
+
+ ST
+
@@ -70,6 +73,10 @@
approved
00
+
out
-
+
@@ -285,7 +285,7 @@
/>
1
-
+
out
@@ -385,7 +385,7 @@
/>
1
-
+
out
@@ -946,5 +946,53 @@
+
+
+
+
+
+
+ 1
+
+
+ out
+
+
+
+
+ Teste
+
+
+ 100
+ 1
+ out
+
+
+
+
+
+
+
+
+
+ 100
+
+
+
+
+
+
+
+
+
diff --git a/l10n_br_fiscal/demo/product_demo.xml b/l10n_br_fiscal/demo/product_demo.xml
index da9bb80e4161..7de5a2698573 100644
--- a/l10n_br_fiscal/demo/product_demo.xml
+++ b/l10n_br_fiscal/demo/product_demo.xml
@@ -1978,4 +1978,62 @@
+
+
+ Office Lamp ST
+
+ 35.0
+ 40.0
+ consu
+ 0.01
+
+
+ FURN_8889
+
+
+
+
+
+
+
+
+ fiscal_type
+
+ 00
+ selection
+
+
+
+
+
+ icms_origin
+
+ 5
+ selection
+
+
+
diff --git a/l10n_br_fiscal/tests/test_fiscal_document_generic.py b/l10n_br_fiscal/tests/test_fiscal_document_generic.py
index 281ecbd945f4..aa0fc2510330 100644
--- a/l10n_br_fiscal/tests/test_fiscal_document_generic.py
+++ b/l10n_br_fiscal/tests/test_fiscal_document_generic.py
@@ -15,6 +15,7 @@ def setUpClass(cls):
# Contribuinte
cls.nfe_same_state = cls.env.ref("l10n_br_fiscal.demo_nfe_same_state")
cls.nfe_other_state = cls.env.ref("l10n_br_fiscal.demo_nfe_other_state")
+ cls.nfe_other_state_st = cls.env.ref("l10n_br_fiscal.demo_nfe_other_state_st")
cls.nfe_not_taxpayer = cls.env.ref("l10n_br_fiscal.demo_nfe_nao_contribuinte")
cls.nfe_not_taxpayer_pf = cls.env.ref(
@@ -174,7 +175,7 @@ def test_nfe_other_state(self):
self.nfe_other_state._onchange_document_serie_id()
self.nfe_other_state._onchange_fiscal_operation_id()
-
+ self.nfe_other_state.action_document_confirm()
for line in self.nfe_other_state.fiscal_line_ids:
line._onchange_product_id_fiscal()
line._onchange_commercial_quantity()
@@ -291,6 +292,127 @@ def test_nfe_other_state(self):
"from COFINS 3% for Venda de Contribuinte p/ Fora do Estado.",
)
+ def test_nfe_other_state_st(self):
+ """Test NFe other state."""
+ self.nfe_other_state_st._onchange_document_serie_id()
+ self.nfe_other_state_st._onchange_fiscal_operation_id()
+
+ for line in self.nfe_other_state_st.fiscal_line_ids:
+ line._onchange_product_id_fiscal()
+ line._onchange_commercial_quantity()
+ line._onchange_ncm_id()
+ line._onchange_fiscal_operation_id()
+ line._onchange_fiscal_operation_line_id()
+ line._onchange_fiscal_taxes()
+
+ if "Revenda" in line.fiscal_operation_line_id.name:
+ self.assertEqual(
+ line.cfop_id.code,
+ "6102",
+ "Error to mapping CFOP 6102"
+ " for Revenda de Contribuinte p/ Fora do Estado.",
+ )
+ else:
+ self.assertEqual(
+ line.cfop_id.code,
+ "6101",
+ "Error to mapping CFOP 6101"
+ " for Venda de Contribuinte p/ Fora do Estado.",
+ )
+
+ # ICMS
+ if line.product_id.icms_origin in ICMS_ORIGIN_TAX_IMPORTED:
+ self.assertEqual(
+ line.icms_tax_id.name,
+ "ICMS 4%",
+ "Error to mapping ICMS 4%"
+ " for Venda de Contribuinte p/ Fora do Estado.",
+ )
+ self.assertEqual(
+ line.icms_cst_id.code,
+ "00",
+ "Error to mapping CST 00 from ICMS 4%"
+ " for Venda de Contribuinte p/ Fora do Estado.",
+ )
+ else:
+ self.assertEqual(
+ line.icms_tax_id.name,
+ "ICMS 7%",
+ "Error to mapping ICMS 7%"
+ " for Venda de Contribuinte p/ Fora do Estado.",
+ )
+ self.assertEqual(
+ line.icms_cst_id.code,
+ "00",
+ "Error to mapping CST 00 from ICMS 7%"
+ " for Venda de Contribuinte p/ Fora do Estado.",
+ )
+
+ # ICMS FCP
+ self.assertFalse(
+ line.icmsfcp_tax_id,
+ "Error to mapping ICMS FCP 2%"
+ " for Venda de Contribuinte Dentro do Estado.",
+ )
+
+ # IPI
+ if "Revenda" in line.fiscal_operation_line_id.name:
+ self.assertEqual(
+ line.ipi_tax_id.name,
+ "IPI NT",
+ "Error to mapping IPI NT"
+ " for Revenda de Contribuinte Dentro do Estado.",
+ )
+ self.assertEqual(
+ line.ipi_cst_id.code,
+ "53",
+ "Error to mapping CST 53 from IPI NT"
+ " to Revenda de Contribuinte Dentro do Estado.",
+ )
+ else:
+ self.assertEqual(
+ line.ipi_tax_id.name,
+ "IPI 5%",
+ "Error to mapping IPI 5%"
+ " for Venda de Contribuinte Dentro do Estado.",
+ )
+ self.assertEqual(
+ line.ipi_cst_id.code,
+ "50",
+ "Error to mapping CST 50 from IPI 5%"
+ " to Venda de Contribuinte Dentro do Estado.",
+ )
+
+ # PIS
+ self.assertEqual(
+ line.pis_tax_id.name,
+ "PIS 0,65%",
+ "Error to mapping PIS 0,65%"
+ " for Venda de Contribuinte p/ Fora do Estado.",
+ )
+ self.assertEqual(
+ line.pis_cst_id.code,
+ "01",
+ "Error to mapping CST 01 - Operação Tributável com Alíquota"
+ " Básica from PIS 0,65% for"
+ " Venda de Contribuinte p/ Fora do Estado.",
+ )
+
+ # PIS
+ self.assertEqual(
+ line.cofins_tax_id.name,
+ "COFINS 3%",
+ "Error to mapping COFINS 3%"
+ " for Venda de Contribuinte p/ Fora do Estado.",
+ )
+ self.assertEqual(
+ line.cofins_cst_id.code,
+ "01",
+ "Error to mapping CST 01 -"
+ " Operação Tributável com Alíquota Básica"
+ "from COFINS 3% for Venda de Contribuinte p/ Fora do Estado.",
+ )
+
def test_nfe_not_taxpayer(self):
"""Test NFe not taxpayer."""