Odoo Help


obtain the id of a self (onchange) odoo

on 4/26/16, 11:41 AM 1,289 views

I have this code onchange

    def _onchange_cor(self):
        if self.the_geom != False:
            self.env.cr.execute('SELECT the_geom from geolocalizacion_plot')

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

how to get the id of self (the current record)

On 5/19/16, 3:39 AM

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

Thanks you saved my time.

on 12/6/16, 2:46 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/26/16, 11:41 AM
Seen: 1289 times
Last updated: 5/19/16, 3:40 AM