在ODOO8上,继承模型上的init()方法不会被调用
在odoo 8.0上,我需要重写父模型init()方法,但升级模块时从未调用新的init() 有没有一些晦涩的未经记录的奥多技巧在ODOO8上,继承模型上的init()方法不会被调用,odoo,init,auto,Odoo,Init,Auto,在odoo 8.0上,我需要重写父模型init()方法,但升级模块时从未调用新的init() 有没有一些晦涩的未经记录的奥多技巧 class A(models.Model): _name = "A" _auto = False columnA = .... def init(self, cr): # ... here there is a CREATE VIEW .... # in another module... class A(mod
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 ...
升级模块时,继承的init()永远不会被调用。
它总是调用父(类A)init方法
令人惊讶的是,columnB是在modelA中创建的,因此继承的类被认为是。。。。但在运行时,不会调用它的init()方法*
- 在调试模式下验证并设置断点
\u auto=False
。然后升级模块。如果添加了新字段,则应调用init。奇怪的是,它对我起了预期的作用。我不知道你做错了什么,但你的代码应该可以工作