Skip to Content
Menu
This question has been flagged

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.

Avatar
Discard
Related Posts Replies Views Activity
2
Dec 15
2981
2
Mar 15
9478
3
Jan 20
35910
4
Jan 16
9164
1
Sep 15
2652