Skip to content

Commit

Permalink
[IMP] l10n_br_fiscal: add product.tag test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiago370 committed Nov 27, 2024
1 parent 267ba5a commit 4f17d7e
Show file tree
Hide file tree
Showing 4 changed files with 408 additions and 4 deletions.
60 changes: 60 additions & 0 deletions l10n_br_fiscal/data/operation_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,36 @@
<field name="product_type">00</field>
</record>

<record id="product_tag_st_6404" model="l10n_br_fiscal.product.tag">
<field name="name">ST CFOP 6404</field>
</record>
<record id="product_tag_st_6401" model="l10n_br_fiscal.product.tag">
<field name="name">ST CFOP 6401</field>
</record>

<record
id="tax_icms_regulation_other_state_st_1"
model="l10n_br_fiscal.tax.definition"
>
<field name="tax_group_id" ref="l10n_br_fiscal.tax_group_icms" />
<field name="is_taxed" eval="True" />
<field name="is_debit_credit" eval="True" />
<field name="custom_tax" eval="True" />
<field name="tax_id" ref="l10n_br_fiscal.tax_icms_12_st" />
<field name="state">approved</field>
</record>
<record
id="tax_icms_regulation_other_state_st_2"
model="l10n_br_fiscal.tax.definition"
>
<field name="tax_group_id" ref="l10n_br_fiscal.tax_group_icmsst" />
<field name="is_taxed" eval="True" />
<field name="is_debit_credit" eval="True" />
<field name="custom_tax" eval="True" />
<field name="tax_id" ref="l10n_br_fiscal.tax_icmsst_p30_50" />
<field name="state">approved</field>
</record>

<record id="fo_venda_venda_st_substituto" model="l10n_br_fiscal.operation.line">
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda" />
<field name="name">Venda ST contribuinte substituto</field>
Expand All @@ -50,6 +80,15 @@
<field name="cfop_external_id" ref="l10n_br_fiscal.cfop_6401" />
<field name="state">approved</field>
<field name="product_type">04</field>
<field
name="product_fiscal_tag_ids"
eval="[(6,0,[ref('l10n_br_fiscal.product_tag_st_6401')])]"
/>
<field name="tax_icms_or_issqn">icms</field>
<field
name="tax_definition_ids"
eval="[(6, 0, [ref('l10n_br_fiscal.tax_icms_regulation_other_state_st_1'),ref('l10n_br_fiscal.tax_icms_regulation_other_state_st_2')])]"
/>
</record>

<record id="fo_venda_revenda_st_substituto" model="l10n_br_fiscal.operation.line">
Expand All @@ -62,6 +101,18 @@
<field name="product_type">00</field>
</record>

<record
id="tax_icms_regulation_other_state_st"
model="l10n_br_fiscal.tax.definition"
>
<field name="tax_group_id" ref="l10n_br_fiscal.tax_group_icms" />
<field name="is_taxed" eval="True" />
<field name="is_debit_credit" eval="True" />
<field name="custom_tax" eval="True" />
<field name="tax_id" ref="l10n_br_fiscal.tax_icms_antst" />
<field name="state">approved</field>
</record>

<record id="fo_venda_revenda_st_substituido" model="l10n_br_fiscal.operation.line">
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda" />
<field name="name">Revenda ST contribuinte substituído</field>
Expand All @@ -70,6 +121,15 @@
<field name="cfop_external_id" ref="l10n_br_fiscal.cfop_6404" />
<field name="state">approved</field>
<field name="product_type">00</field>
<field
name="product_fiscal_tag_ids"
eval="[(6,0,[ref('l10n_br_fiscal.product_tag_st_6404')])]"
/>
<field name="tax_icms_or_issqn">icms</field>
<field
name="tax_definition_ids"
eval="[(6, 0, [ref('l10n_br_fiscal.tax_icms_regulation_other_state_st')])]"
/>
</record>

<record
Expand Down
117 changes: 114 additions & 3 deletions l10n_br_fiscal/demo/fiscal_document_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<field name="partner_id" ref="l10n_br_base.res_partner_cliente1_sp" />
<field name="user_id" ref="base.user_demo" />
<field name="fiscal_operation_type">out</field>
<!-- <field name="file_xml_autorizacao_id" ref="dummy_file_1"/> FIXME: Este é um campo related!!!!-->
<!-- <field name="file_xml_autorizacao_id" ref="dummy_file_1"/> FIXME: Este é um campo related!!!!-->
</record>

<record id="demo_nfe_line_same_state_1-1" model="l10n_br_fiscal.document.line">
Expand Down Expand Up @@ -285,7 +285,7 @@
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
<field name="document_serie">1</field>
<field name="partner_id" ref="l10n_br_base.res_partner_cliente9_mg" />
<field name="partner_id" ref="l10n_br_base.res_partner_cliente9_mg" />
<field name="user_id" ref="base.user_demo" />
<field name="fiscal_operation_type">out</field>
</record>
Expand Down Expand Up @@ -385,7 +385,7 @@
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
<field name="document_serie">1</field>
<field name="partner_id" ref="l10n_br_base.res_partner_cliente9_mg" />
<field name="partner_id" ref="l10n_br_base.res_partner_cliente9_mg" />
<field name="user_id" ref="base.user_demo" />
<field name="fiscal_operation_type">out</field>
</record>
Expand Down Expand Up @@ -946,5 +946,116 @@
<value eval="[ref('demo_nfe_purchase_line_same_state_1-1')]" />
</function>

<!-- NFe Test - Empresa Contribuinte - Outro Estado ST - CFOP 6404 -->
<record id="demo_nfe_other_state_st_6404" model="l10n_br_fiscal.document">
<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_lc_document_55_serie_1"
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
<field name="document_serie">1</field>
<field name="partner_id" ref="l10n_br_base.res_partner_cliente5_pe" />
<field name="user_id" ref="base.user_demo" />
<field name="fiscal_operation_type">out</field>
</record>

<record
id="demo_nfe_line_other_state_st_6404_1-1"
model="l10n_br_fiscal.document.line"
>
<field name="document_id" ref="demo_nfe_other_state_st_6404" />
<field name="name">Teste ST</field>
<field name="product_id" ref="l10n_br_fiscal.product_delivery_02_st_6404" />
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="price_unit">100</field>
<field name="quantity">1</field>
<field name="fiscal_operation_type">out</field>
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda" />
<field name="icms_tax_id" ref="l10n_br_fiscal.tax_icms_antst" />
<field
name="fiscal_operation_line_id"
ref="l10n_br_fiscal.fo_venda_revenda_st_substituido"
/>
</record>

<function model="l10n_br_fiscal.document.line" name="_onchange_product_id_fiscal">
<value eval="[ref('demo_nfe_line_other_state_st_6404_1-1')]" />
</function>

<record
id="demo_nfe_line_other_state_st_6404_1-1"
model="l10n_br_fiscal.document.line"
>
<field name="price_unit">100</field>
</record>

<function model="l10n_br_fiscal.document.line" name="_onchange_fiscal_operation_id">
<value eval="[ref('demo_nfe_line_other_state_st_6404_1-1')]" />
</function>

<function
model="l10n_br_fiscal.document.line"
name="_onchange_fiscal_operation_line_id"
>
<value eval="[ref('demo_nfe_line_other_state_st_6404_1-1')]" />
</function>

<!-- NFe Test - Empresa Contribuinte - Outro Estado ST - CFOP 6401 -->
<record id="demo_nfe_other_state_st_6401" model="l10n_br_fiscal.document">
<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_lc_document_55_serie_1"
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
<field name="document_serie">1</field>
<field name="partner_id" ref="l10n_br_base.res_partner_cliente5_pe" />
<field name="user_id" ref="base.user_demo" />
<field name="fiscal_operation_type">out</field>
</record>

<record
id="demo_nfe_line_other_state_st_6401_1-1"
model="l10n_br_fiscal.document.line"
>
<field name="document_id" ref="demo_nfe_other_state_st_6401" />
<field name="name">Teste ST</field>
<field name="product_id" ref="l10n_br_fiscal.product_delivery_02_st_6401" />
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="price_unit">100</field>
<field name="quantity">1</field>
<field name="fiscal_operation_type">out</field>
<field name="fiscal_operation_id" ref="l10n_br_fiscal.fo_venda" />
<field name="icms_tax_id" ref="l10n_br_fiscal.tax_icms_antst" />
<field
name="fiscal_operation_line_id"
ref="l10n_br_fiscal.fo_venda_revenda_st_substituido"
/>
</record>

<function model="l10n_br_fiscal.document.line" name="_onchange_product_id_fiscal">
<value eval="[ref('demo_nfe_line_other_state_st_6401_1-1')]" />
</function>

<record
id="demo_nfe_line_other_state_st_6401_1-1"
model="l10n_br_fiscal.document.line"
>
<field name="price_unit">100</field>
</record>

<function model="l10n_br_fiscal.document.line" name="_onchange_fiscal_operation_id">
<value eval="[ref('demo_nfe_line_other_state_st_6401_1-1')]" />
</function>

<function
model="l10n_br_fiscal.document.line"
name="_onchange_fiscal_operation_line_id"
>
<value eval="[ref('demo_nfe_line_other_state_st_6401_1-1')]" />
</function>

</odoo>
122 changes: 122 additions & 0 deletions l10n_br_fiscal/demo/product_demo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1978,4 +1978,126 @@
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
</record>

<!-- Product ST CFOP 6404 -->
<record id="product_delivery_02_st_6404" model="product.product">
<field name="name">Office Lamp ST 6404</field>
<field name="tax_icms_or_issqn">icms</field>
<field name="categ_id" ref="product.product_category_5" />
<field name="standard_price">35.0</field>
<field name="list_price">40.0</field>
<field name="type">consu</field>
<field name="weight">0.01</field>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
<field name="default_code">FURN_8889</field>
<field
name="operation_line_tag_ids"
eval="[(6,0,[ref('l10n_br_fiscal.product_tag_st_6404')])]"
/>
<field
name="image_1920"
type="base64"
file="product/static/img/product_lamp.png"
/>
<field name="ncm_id" ref="l10n_br_fiscal.ncm_94052000" />
<field name="cest_id" ref="l10n_br_fiscal.cest_2112400" />
<field name="fiscal_genre_id" ref="l10n_br_fiscal.product_genre_94" />
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
</record>
<!-- fiscal_type property for product_delivery_02_st_6404 for lucro presumido company -->
<record
forcecreate="True"
id="fiscal_type_product_delivery_02_st_6404"
model="ir.property"
>
<field name="name">fiscal_type</field>
<field name="fields_id" ref="field_product_template__fiscal_type" />
<field name="value">00</field>
<field name="type">selection</field>
<field
eval="'product.template,'+str(obj().env.ref('l10n_br_fiscal.product_delivery_02_st_6404').product_tmpl_id.id)"
model="product.template"
name="res_id"
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
</record>
<!-- icms_origin property for product_delivery_02_st_6404 for simples nacional company -->
<record
forcecreate="True"
id="icms_origin_product_delivery_02_st_6404"
model="ir.property"
>
<field name="name">icms_origin</field>
<field name="fields_id" ref="field_product_template__icms_origin" />
<field name="value">5</field>
<field name="type">selection</field>
<field
eval="'product.template,'+str(obj().env.ref('l10n_br_fiscal.product_delivery_02_st_6404').product_tmpl_id.id)"
model="product.template"
name="res_id"
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
</record>


<!-- Product ST CFOP 6401 -->
<record id="product_delivery_02_st_6401" model="product.product">
<field name="name">Office Lamp ST 6401</field>
<field name="tax_icms_or_issqn">icms</field>
<field name="categ_id" ref="product.product_category_5" />
<field name="standard_price">35.0</field>
<field name="list_price">40.0</field>
<field name="type">consu</field>
<field name="weight">0.01</field>
<field name="uom_id" ref="uom.product_uom_unit" />
<field name="uom_po_id" ref="uom.product_uom_unit" />
<field name="default_code">FURN_8880</field>
<field
name="operation_line_tag_ids"
eval="[(6,0,[ref('l10n_br_fiscal.product_tag_st_6401')])]"
/>
<field
name="image_1920"
type="base64"
file="product/static/img/product_lamp.png"
/>
<field name="ncm_id" ref="l10n_br_fiscal.ncm_94052000" />
<field name="cest_id" ref="l10n_br_fiscal.cest_2112400" />
<field name="fiscal_genre_id" ref="l10n_br_fiscal.product_genre_94" />
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
</record>
<!-- fiscal_type property for product_delivery_02_st_6401 for lucro presumido company -->
<record
forcecreate="True"
id="fiscal_type_product_delivery_02_st_6401"
model="ir.property"
>
<field name="name">fiscal_type</field>
<field name="fields_id" ref="field_product_template__fiscal_type" />
<field name="value">04</field>
<field name="type">selection</field>
<field
eval="'product.template,'+str(obj().env.ref('l10n_br_fiscal.product_delivery_02_st_6401').product_tmpl_id.id)"
model="product.template"
name="res_id"
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
</record>
<!-- icms_origin property for product_delivery_02_st_6401 for simples nacional company -->
<record
forcecreate="True"
id="icms_origin_product_delivery_02_st_6401"
model="ir.property"
>
<field name="name">icms_origin</field>
<field name="fields_id" ref="field_product_template__icms_origin" />
<field name="value">5</field>
<field name="type">selection</field>
<field
eval="'product.template,'+str(obj().env.ref('l10n_br_fiscal.product_delivery_02_st_6401').product_tmpl_id.id)"
model="product.template"
name="res_id"
/>
<field name="company_id" ref="l10n_br_base.empresa_lucro_presumido" />
</record>
</odoo>
Loading

0 comments on commit 4f17d7e

Please sign in to comment.