2

On odoo 8.0 I need to override parent model init() method, but the new init() is never called upon upgrading the module

Is there some obscure undocumented odoo trick for this?

class A(models.Model):
    _name = "A"
    _auto = False

    columnA = ....

    def init(self, cr):
        # ... here there is a CREATE VIEW .... 

# in another module...
class A(models.Model)
    _inherit = "A"
    _auto = False

    columnB = ....

    def init(self, cr):
        #... NEW VIEW DEFINITION ...

Upon upgrading the module, inherited init() never gets called. It always calls parent (class A) init method.

Amazingly, columnB is created in the modelA, hence inherited class is considered.... but at run time, its init() method is not called*

  • Verified in debug mode and with breakpoints set
  • Try to add new field just for testing, and you don't need to specify `_auto = False` when you inherit. then upgrade you module if the new field is added then you init should be called. weird it worked for me as expected don't know what you did wrong but your code should work – Charif DZ Jun 14 '19 at 06:51

0 Answers0