and i want to appear message when price_subtotal > minimum_amount
-----add the field in Product
from odoo import api, fields, models, _
class ProductTemplate(models.Model):
_inherit = "product.template"
minimum_amount = fields.Float('Minimum Order Amount')
-------and i want to appear message when price_subtotal > minimum_amount
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
@api.model
def create(self,vals):
result = super(SaleOrderLine,self).create(vals)
if vals.get('product_id'):
product = self.env['product.product'].search([('id','=',vals['product_id'])])
total_all = vals['price_subtotal']
if total_all
raise ValidationError(_( "Minimum order amount of the product %s is %s.") % (vals['name'],product.minimum_amount))
return result