Skip to content

Commit

Permalink
[IMP] l10n_br_fiscal: tax_definition add Service Type
Browse files Browse the repository at this point in the history
  • Loading branch information
kaynnan committed Oct 28, 2024
1 parent e81bb43 commit 1167db2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 12 deletions.
1 change: 1 addition & 0 deletions l10n_br_fiscal/models/document_line_mixin_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ def _onchange_fiscal_operation_line_id(self):
nbs=self.nbs_id,
cest=self.cest_id,
city_taxation_code=self.city_taxation_code_id,
service_type=self.service_type_id,
ind_final=self.ind_final,
)

Expand Down
5 changes: 5 additions & 0 deletions l10n_br_fiscal/models/operation_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def map_fiscal_taxes(
nbs=None,
cest=None,
city_taxation_code=None,
service_type=None,
ind_final=None,
):
mapping_result = {
Expand All @@ -226,6 +227,7 @@ def map_fiscal_taxes(
nbs=nbs,
cest=cest,
city_taxation_code=city_taxation_code,
service_type=service_type,
):
self._build_mapping_result(mapping_result, tax_definition)

Expand Down Expand Up @@ -270,6 +272,7 @@ def map_fiscal_taxes(
nbs=nbs,
cest=cest,
city_taxation_code=city_taxation_code,
service_type=service_type,
):
self._build_mapping_result(mapping_result, tax_definition)

Expand All @@ -285,6 +288,7 @@ def map_fiscal_taxes(
nbs=nbs,
cest=cest,
city_taxation_code=city_taxation_code,
service_type=service_type,
):
self._build_mapping_result(mapping_result, tax_definition)

Expand All @@ -300,6 +304,7 @@ def map_fiscal_taxes(
nbs=nbs,
cest=cest,
city_taxation_code=city_taxation_code,
service_type=service_type,
):
self._build_mapping_result(mapping_result, tax_definition)

Expand Down
12 changes: 12 additions & 0 deletions l10n_br_fiscal/models/tax_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ def name_get(self):
string="City Taxation Codes",
)

service_type_ids = fields.Many2many(
comodel_name="l10n_br_fiscal.service.type",
relation="tax_definition_service_type_rel",
column1="tax_definition_id",
column2="service_type_id",
string="Fiscal Service Types",
)

ind_final = fields.Selection(
selection=FINAL_CUSTOMER,
string="Final Consumption Operation",
Expand Down Expand Up @@ -423,6 +431,7 @@ def map_tax_definition(
nbs=None,
cest=None,
city_taxation_code=None,
service_type=None,
):
if not ncm:
ncm = product.ncm_id
Expand Down Expand Up @@ -452,6 +461,9 @@ def map_tax_definition(
("city_taxation_code_ids", "=", False),
("city_taxation_code_ids", "=", city_taxation_code.id),
"|",
("service_type_ids", "=", False),
("service_type_ids", "=", service_type.id),
"|",
("product_ids", "=", False),
("product_ids", "=", product.id),
]
Expand Down
26 changes: 14 additions & 12 deletions l10n_br_fiscal/views/tax_definition_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,12 @@
string="Tax Benefit"
attrs="{'invisible': [('is_benefit', '=', False)]}"
>
<field
name="code"
attrs="{'required': [('is_benefit', '!=', False)]}"
/>
<field
<field name="code" attrs="{'required': [('is_benefit', '!=', False)]}" />
<field
name="description"
attrs="{'required': [('is_benefit', '!=', False)]}"
/>
<field
<field
name="benefit_type"
attrs="{'required': [('is_benefit', '!=', False)]}"
/>
Expand Down Expand Up @@ -210,22 +207,27 @@
/>
</group>
</page>
<page name="service_types_page" string="Fiscal Service Type">
<group name="service_types" string="Fiscal Service Types">
<field name="service_type_ids" force_save="1" nolabel="1" colspan="2" />
</group>
</page>
<page name="products_page" string="Product">
<group name="products" string="Products">
<field name="product_ids" force_save="1" nolabel="1" colspan="2" />
</group>
</page>
<page name="fiscal_profile_page" string="Fiscal Profile">
<group name="fiscal_profile" string="Fiscal Profile">
<field name="ind_final" />
</group>
<group name="fiscal_profile" string="Fiscal Profile">
<field name="ind_final" />
</group>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" groups="base.group_user" />
<field name="activity_ids" />
<field name="message_ids" />
<field name="message_follower_ids" groups="base.group_user" />
<field name="activity_ids" />
<field name="message_ids" />
</div>
</form>
</field>
Expand Down

0 comments on commit 1167db2

Please sign in to comment.