OpenERP:覆盖多模块的onchange功能 [英] OpenERP : Multiple module overriding onchange function
问题描述
我需要重写sale.order中存在的onchange_partner_id
函数,但是我正在使用已经有一个模块重写此功能的系统.
我试图用类似的代码编写自己的onchange_partner_id
:
I need to override onchange_partner_id
function present in sale.order but I'm working on a system that already have a module overriding this function.
I tried to write my own onchange_partner_id
with similar code :
def onchange_partner_id(self, cr, uid, ids, part):
res = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)
// doing some stuff and adding it to res['value']['myfield']
return res
但是OpenERP无法读取我的函数. 所以我的问题是,是否可以有多个功能覆盖同一功能,如果可以的话,我该如何进行? 预先感谢
But my function isn't read by OpenERP. So my question is, is it possible to have multiple function overriding the same function and if i's possible how do I proceed ? Thanks in advance
推荐答案
是的,您可以重写此方法,因为您需要定义继承sale.order
的新类并定义您的方法.
Yes you can override this method, for that you need to define new class in which inherit sale.order
and define your method.
您的方法肯定会被调用.
Your method will be called definitely.
class sale_order(osv.osv):
_inherit = 'sale.order'
def onchange_partner_id(self, cr, uid, ids, part, context=None):
res = super(sale_order, self).onchange_partner_id(cr, uid, ids, part,context=context)
// doing some stuff and adding it to res['value']['myfield']
return res
这篇关于OpenERP:覆盖多模块的onchange功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!