2
0
account-financial-tools/account_fiscal_position_vat_check/models/partner.py
Alexis de Lattre f2463936bd account_fiscal_position_vat_check: warning banner
A yellow warning banner is now displayed on the partner form view when
the fiscal position requires a VAT number and the VAT number is missing.
This banner replaces the warning message triggered by the onchange.

Improve README of the module with v14 screenshots.
2022-10-20 11:33:24 +02:00

24 lines
785 B
Python

# Copyright 2013-2022 Akretion France (https://akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class ResPartner(models.Model):
_inherit = "res.partner"
show_warning_vat_required = fields.Boolean(
compute="_compute_show_warning_vat_required"
)
@api.depends("property_account_position_id", "vat")
@api.depends_context("company")
def _compute_show_warning_vat_required(self):
for partner in self:
show = False
fp = partner.property_account_position_id
if fp and fp.vat_required and not partner.vat:
show = True
partner.show_warning_vat_required = show