oca-financial/odoo-bringout-oca-account-fiscal-rule-account_ecotax_tax/account_ecotax_tax/models/account_tax.py
2025-08-29 15:43:04 +02:00

32 lines
1 KiB
Python

# © 2014-2024 Akretion (http://www.akretion.com)
# @author Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class AccountTax(models.Model):
_inherit = "account.tax"
is_ecotax = fields.Boolean(
"Ecotax",
help="Warning : To include Ecotax "
"in the VAT tax check this :\n"
'1: check "included in base amount "\n'
"2: The Ecotax sequence must be less then "
"VAT tax (in sale and purchase)",
)
@api.onchange("is_ecotax")
def onchange_is_ecotax(self):
if self.is_ecotax:
self.amount_type = "code"
self.include_base_amount = True
self.python_compute = """
# price_unit
# product: product.product object or None
# partner: res.partner object or None
# for weight based ecotax
# result = quantity and product.weight_based_ecotax * quantity or 0.0
result = quantity and product.fixed_ecotax * quantity or 0.0
"""