In odoo10, I wrote a @api.onchange function on change of name which return warning popup if name already in database, so As I click on save button after giving input in name field then It returning a warning popup but also form saving on background which I don't want.
So, what is the actual problem here? Please find attached screenshot below. Thanks
@api.onchange('displayname', 'firstname', 'lastname') @api.multi def check_duplicate_name(self): if self.name: contact = self.env['res.partner'].search([('name', '=', self.name)]) if contact: return { 'warning': { 'title': 'Warning Message', 'warning': 'Company/Contact name already exist.\nDo you want to continue?', } }
– rahul mehra