Reputation: 171
I have this code onchange
@api.onchange('the_geom')
def _onchange_cor(self):
if self.the_geom != False:
self.env.cr.execute('SELECT the_geom from geolocalizacion_plot')
self.cor2=self.env.cr.fetchone()[0]
self.cor=self.id
but self.id returns <openerp.models.NewId object at 0x7f904b586e10>
how to get the id of self (the current record)
Upvotes: 0
Views: 2936
Reputation: 14778
I don't understand your code or your concept here, but in on_changes odoo creates a new object and replaces self with it. The origin object, what you are looking for can be found under self._origin if i recall correct.
Why do you want to save self.id to self.cor?
Upvotes: 1