Odoo Help

Welcome!

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.

1

Inherit res_partner in installed Module

By
Bhumi Thakkar
on 7/25/14, 12:55 AM 1,781 views

I have inherited res_partner class and added one field type of boolean in Installed Module. I have not added new created field in view. 

Now i am going to restart server & reload page then i want to upgrade module.

But on reload page i got error:

 column res_partner.rtpname does not exist.

It should not come on reload page & let m upgrade module. Same scenario if i follow for other object then will not get error only for res_partner getting error.

 

 

Hi, can you paste the module inheritance?

klacus
on 7/25/14, 1:52 AM
2
Mayur Maheshwari
On 7/25/14, 2:08 AM

To Do inheritance  in OpenERP ,  you can use this code which is more batter and  it's works for  me !

class res_partner(osv.osv):
    _inherit = "res.partner"
    _columns = {
            'field_name': fields.boolean('Field name'),             
            }
            
res_partner()

 

 

 

No need to call constructor at the end of class. It is outdated now from V7 and V8 too. Optimize your code, as less as possible !

Hiren Vora - CEO at Emipro Technologies Pvt. Ltd. India
on 7/25/14, 3:02 AM
0

Hello Bhumi,

I guess you still getting problem. Because as per my knowledge,

when you add any field in  res.partner model, you need to update your module from command line.

like go to terminal and run,

  • python openerp-server --update=[ here your module in which res.partner model is inherited. ]

By updating module from command line, your problem will be solved and that column will be added into ir.model.fields & db table too. 

Let me know if still you are getting problem,

Reason behind this behaviour : 

The reason of this should be ( As per my point of view & thinking) : When you add any field in res.partner class and restart Odoo, at that time somewhere Odoo might be doing browse of particular uid. ( You know, res.user class is attached to res.partner from V7 onwards. )

Now, in .py file there is column found but due to Odoo has did browse of record before update the module, it will not able to find that column in res_partner table.

For example, delete any column from res_partner table and then do browse of that partner record. You will find the same error which you are getting at the time of update.

Technically this should be the reason behind this.

 

 

Regards,

Hi @Hiren. Can you please help me in my question as well...https://www.odoo.com/forum/help-1/question/record-rule-for-project-tasks-58528

dirtyHandsPHP
on 7/25/14, 6:57 AM
0
dirtyHandsPHP
On 7/25/14, 5:54 AM

I think only two stpes are enough :

1. Update your module from Settings -> Installed Modules section.

2. Restart OpenERP server using following command :

./openerp-server -u <module_name> -d <db_name>

0
Bhumi Thakkar
On 7/25/14, 3:40 AM

Hi Hiren,

 Thanks for reply.   

Yes i know this. I have to forcefully update module from command line. but the question is that for any other module if i inherited like for product.product or product.template in installed module then no need to update from commnad line. You can reload & then update from Settings -> Installed Modules.

Thanks & Regards,

Bhumi Thakkar. 

 

 

Thanks.

 

Can you refresh the base modul? On the depencies your openerp.py also must include base.

klacus
on 7/25/14, 3:47 AM

Hello Bhumi, The reason of this should be ( As per my point of view & thinking) : When you add any field in res.partner class and restart Odoo, at that time somewhere Odoo might be doing browse of particular uid. ( You know, res.user class is attached to res.partner from V7 onwards. ) Now, in .py file there is column found but due to Odoo has did browse of record before update the module, it will not able to find that column in res_partner table. For example, delete any column from res_partner table and then do browse of that partner record. You will find the same error which you are getting at the time of update. Technically this should be the reason behind this. Let me know if still you have confusion.

Hiren Vora - CEO at Emipro Technologies Pvt. Ltd. India
on 7/25/14, 5:12 AM
-1
klacus
On 7/25/14, 2:12 AM

Deleted

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

2 follower(s)

Stats

Asked: 7/25/14, 12:55 AM
Seen: 1781 times
Last updated: 3/16/15, 8:10 AM