f2463936bd
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.
24 lines
785 B
Python
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
|