Skip to Content
मेन्यू
This question has been flagged
1 Reply
50845 Views

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)

Avatar
Discard

This will solve your problem.

Reference: https://www.youtube.com/watch?v=eYVD_m6-jz8&t=4s

Author Best Answer

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.id

Avatar
Discard

Thanks you saved my time.

Related Posts Replies Views Activity
4
जन॰ 20
6475
1
नव॰ 22
3138
2
दिस॰ 19
3306
1
फ़र॰ 23
3672
1
फ़र॰ 20
9204