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.

0

How does ORM method inheritance work?

By
splucena
on 8/8/15, 5:34 AM 809 views

I no longer understand inheritance.

I am trying to override the name_get method of the model product.product which was overridden by a different module. My questions are:

Question 1: Why is my name_get method not triggered unless I put the original overriding module in my descriptor file. Ex. 'depends': 'product_custom'

Question 2: (overriding module is included in my descriptor file). My name_get gets called and context gets followed but after realeasing the mouse on the one2many_list field my context no longer get called setting the original overriding module name_get to be called.

Code:

THIS GETS CALLED WHEN ONE2MANY FIELD IS CLICKED

if context.get('marker', False):

    for product in self.browse(cr, uid, ids, context):

        name = product.name

        res.append([product.id, name])

    return res

THIS GETS CALLED WHEN ONE2MANY FIELD IS RELEASED

else:

    return super(overriding_module, self).name_get(cr, uid, ids, context)

I have added a marker on my XML and injected one using the fields_view_get method.

I have checked this links as reference https://www.odoo.com/forum/help-1/question/using-name-get-how-to-shows-two-different-display-values-2589#answer-57376, https://anybox.fr/blog/inside-openerp-inheritance

My question is similar to this question in stackoverflow http://stackoverflow.com/questions/30080690/openerp-multiple-module-overriding-onchange-function

Thanks in advance.

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)

Stats

Asked: 8/8/15, 5:34 AM
Seen: 809 times
Last updated: 8/10/15, 6:10 PM