Skip to Content
Menu
This question has been flagged
4566 Zobrazenia

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
Zrušiť
Related Posts Replies Zobrazenia Aktivita
2
dec 15
3648
2
mar 15
10574
3
jan 20
37599
4
jan 16
10308
1
sep 15
3379