# License AGPL-3 - See https://www.gnu.org/licenses/agpl-3.0 from odoo import models, fields, api, _ from odoo.exceptions import ValidationError class ProductProduct(models.Model): _inherit = "product.product" @api.constrains("lst_price", "initial_discount", "fixed_discount") def check_discount_fixed(self): for product in self: if ( product.initial_discount == "fixed" and product.lst_price <= product.initial_discount ): raise ValidationError( _( "Fixed discount for 1st membership must be less than the product template or any of its variants sale price." ) )