Odoo Help


How to get value from DB using Odoo(ver. 9-10) ORM

on 10/27/16, 4:51 AM 257 views

Hi everyone!
I need to get value from Database WITHOUT using SQL in python script.
I was tried to get parent_id field from model 'ir.ui.menu' and set a new value for this field, but unsuccessfully.
Can someone help me with this?

yousif Mobark
On 10/27/16, 5:38 AM

just use the ORM method write.


    rec=self.env['ir.ui.menu'].browes(id) #browes take the record id




Thank you!

And, maybe you know, how to use this in class constructor?

I try to use this

db = sql_db.db_connect('main-db')

cr = db.cursor()

env = api.Environment(cr, SUPERUSER_ID, {})

model = env['ir.ui.menu'].browse(90)

print model.parent_id

And getting error 'ir.ui.menu' object has no attribute 'id'"

Now this code working with decorator '@api.onchange('field')', but I want execute him one time and without any actions on front-end (like changing 'field' like now)

on 10/27/16, 6:41 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: 10/27/16, 4:51 AM
Seen: 257 times
Last updated: 10/27/16, 6:20 AM