Hi all,
How to check if my one2many field have no value
.when I save a record I make product_id a one2many field require =True.but after saving this record it will not shows warning it saved.how to avoid this condition
Below attached my code its not showing alert..
class ServiceDetails(models.Model):class crm_lead(models.Model):
_name='service.info'
service_ids=fields.Many2one('crm.lead','Service')
product_id=fields.Many2one('product.product', 'Service Type',required=True)
details=fields.Char('Remarks')
_inherit='crm.lead'crm_lead_ids=fields.One2many('service.info','service_ids','Service Details',required=True)@api.model
def create(self, values):
if self.crm_lead_ids:
rec = super(crm_lead, self).create(values)
else:
raise Warning('You can not add instructor as a attendee')
return rec