Odoo Help


How to update column dictionary in openerp 7?

on 4/11/14, 8:32 AM 1,875 views

I need to ask how can we update the columns dictionary in openerp7 . I have created dynamic field through button click. The field created is in the db . But to have it on my form , I must update it in the columns dictionary and I donot want it to manually add under _columns. Is there a way to connect a function to a button to update the columns with the newly created field. Without updating to _columns, its not working.

Thanks all

Hi Arsalan,

If you add columns for any module by button click from front end then, it'll keep those in database, which will be not permanent and upon database switch the changes will not reflect.

Hence if it is your custom module, then please add the fields in the _columns dictionary and if it is a base module then, you need to inherit it and add in _columns dictionary. For inheriting module you have to add _inherit = 'base.module.name' in your custom class.


on 4/11/14, 12:03 PM

what I want here is the syntax for updating the field details to _column dict. Hello , I want to know the way to update column dict . Because every now and then I am getting a syntax error. I am using following method definition. Please guide me to fix the issue. def update_column(self,cr,uid,view_id,view_type='form'): fields={} fields.add(string='Names',type='char') _columns.update(fields) . pls guide me

on 4/21/14, 6:20 AM

Hi Arsalan,

The _columns of any module comprises the corresponding DB fields, and if we need some more/new fields we need to simply add it to that manually and restart server to reflect the changes. Here we are writing to a file (.py) , hence the changes will be permanent, over databases just by upgrading the module. But if you try adding/updating that _columns by any method, the changes will be temporary, i.e., upon upgrading/switching DB or re-installing module these fields will be gone. So your function needs to write to the model file (.py) _columns dictionary. Cheers

on 4/22/14, 4:15 AM

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

0 follower(s)


Asked: 4/11/14, 8:32 AM
Seen: 1875 times
Last updated: 3/16/15, 8:10 AM