How to obtain the id of a self (onchange) odoo

Use the

vITraining Admin

If you have this code onchange:

def _onchange_cor(self):
if self.a_field:'SELECT name from a_table where field_id=%s' , (,))

but returns <openerp.models.NewId object at 0x7f904b586e10>

How to get the id of self (the current record)?

In onchange, odoo creates a new object and replaces self with it. The origin object, what you are looking for can be found under