inside create method i have an if condition. in the condition i am performing some insertion. code is not giving any error but record is not inserting into the db, due to the last line raise validation error. if remove that and give return something then the record is inserting into db. how to avoid this ?
def create(self, cr, uid, vals, context=None):
reserve_item_id = vals['reserve_item_id'
result = self.pool.get('item.item').browse(cr, uid, reserve_item_id)
item_count = result.item_count
if result.item_count - result.reserve_count == 0:
vals={}
vals['mail_user_id']=uid
vals['mail_item_id']=reserve_item_id
vals['status']=False
cr.execute("INSERT INTO email_email (mail_user_id,mail_item_id) VALUES (%s, %s)", (uid, reserve_item_id))
raise ValidationError("No Item available")
Hi Pavan, my issues resolved after using curson.commit(). Thank you