Odoo Help


This community 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.


obtain the id of a self (onchange) odoo

on 4/26/16, 11:41 AM 1,011 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

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)


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