Skip to content

Commit 4be4c3b

Browse files
committed
[IMP] excise_management: automation rule for sequence
1 parent d613b1a commit 4be4c3b

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

excise_management/data/base_automation.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,11 @@
2020
<field name="name">Add/Remove Excise Taxes on Fiscal Position</field>
2121
<field name="trigger_field_ids" eval="[(6, 0, [ref('fiscal_position_is_fiscal_deposit')])]"/>
2222
</record>
23+
<record id="base_automation_8" model="base.automation">
24+
<field name="name">Sequence the taxes</field>
25+
<field name="model_id" ref="account.model_account_tax"/>
26+
<field name="action_server_ids" eval="[(6, 0, [ref('requence_the_order_of_taxes')])]"/>
27+
<field name="trigger">on_create_or_write</field>
28+
<field name="trigger_field_ids" eval="[(6, 0, [ref('account.field_account_tax__tax_group_id')])]"/>
29+
</record>
2330
</odoo>

excise_management/data/ir_actions_server.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,12 @@ for fp in records:
4040
<field name="state">code</field>
4141
<field name="name">Add/Remove excise tax on Fiscal Position</field>
4242
</record>
43+
<record id="requence_the_order_of_taxes" model="ir.actions.server">
44+
<field name="code"><![CDATA[all_taxes = env['account.tax'].sudo().search([], order="x_is_excise desc, sequence asc")
45+
for idx, tax in enumerate(all_taxes, start=1):
46+
tax['sequence'] = idx]]></field>
47+
<field name="model_id" ref="account.model_account_tax"/>
48+
<field name="state">code</field>
49+
<field name="name">Sequence the taxes</field>
50+
</record>
4351
</odoo>

0 commit comments

Comments
 (0)