1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/pos_blackbox_be/models/account_tax.py
2024-12-10 09:04:09 +07:00

33 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
class AccountTax(models.Model):
_inherit = "account.tax"
identification_letter = fields.Selection(
[("A", "A"), ("B", "B"), ("C", "C"), ("D", "D")],
compute="_compute_identification_letter",
)
@api.depends("amount_type", "amount")
def _compute_identification_letter(self):
for rec in self:
if rec.type_tax_use == "sale" and (
rec.amount_type == "percent" or rec.amount_type == "group"
):
if rec.amount == 21:
rec.identification_letter = "A"
elif rec.amount == 12:
rec.identification_letter = "B"
elif rec.amount == 6:
rec.identification_letter = "C"
elif rec.amount == 0:
rec.identification_letter = "D"
else:
rec.identification_letter = False
else:
rec.identification_letter = False