Hi all,
I've sucessfully done a modification in account.tax model / amount_type field by adding 'weight' a new select value as follow:
from odoo import fields, models
class AccountTax(models.Model):
_inherit = "account.tax"
amount_type = fields.Selection(default='percent', string="Tax Computation", required=True,
selection=[('group', 'Group of Taxes'), ('fixed', 'Fixed'), ('weight', 'Product weight based'), ('percent', 'Percentage of Price'), ('division', 'Percentage of Price Tax Included')],
help="""
- Group of Taxes: The tax is a set of sub taxes.
- Fixed: The tax amount stays the same whatever the price.
- Product weight based: Fixed amount per Kg.
- Percentage of Price: The tax amount is a % of the price:
e.g 100 * (1 + 10%) = 110 (not price included)
e.g 110 / (1 + 10%) = 100 (price included)
- Percentage of Price Tax Included: The tax amount is a division of the price:
e.g 180 / (1 - 10%) = 200 (not price included)
e.g 200 * (1 - 10%) = 180 (price included)
""")
The issue comes when I try to change amount field behaviuor in account.view_tax_form view's ID
This is view_tax_form record from odoo/addons/account/views/account_tax_views.xml:
<record id="view_tax_form" model="ir.ui.view">
<field name="name">account.tax.formfield>
<field name="model">account.taxfield>
<field name="arch" type="xml">
<form string="Account Tax">
<sheet>
<group>
<group>
<field name="name"/>
<field name="amount_type"/>
<field name="active" widget="boolean_toggle"/>
group>
<group>
<field name="type_tax_use"/>
<field name="tax_scope"/>
<label for="amount" attrs="{'invisible':[('amount_type','not in', ('fixed', 'percent', 'division'))]}"/>
<div attrs="{'invisible':[('amount_type','not in', ('fixed', 'percent', 'division'))]}">
<field name="amount" class="oe_inline" nolabel="1"/>
<span class="o_form_label oe_inline" attrs="{'invisible':[('amount_type','=','fixed')]}">%span>
div>
group>
group>
I pretend to show field amount and change % per KG span tag when weight value is selected.
I've been done many attempts and google research but unfortunately I haven't found anything when extra html tags get in place.
Many thanks for your help!