Need to generate warning message while total amount >= 200000 and vat number in customer is NULL, Here is the code, from odoo import api, fields, models, _ from odoo.exceptions import UserError
class amount_vat_saleorder(models.Model): _inherit = "sale.order"
amount_total = fields.Float(compute="_compute_amount", readonly=1)
@api.onchange('amount_total')
def _compute_amount(self):
if (self.amount_total > 200000) and (self.partner_id.vat == 'NULL') :
raise UserError(_("Update Vat number"))
It works - when I make the IF condition separately.
I need to make onchange function with two conditions at the IF statement. THANKS IN ADVANCE.
Aucun commentaire:
Enregistrer un commentaire