问题
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
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
回答1:
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
来源:https://stackoverflow.com/questions/30080690/openerp-multiple-module-overriding-onchange-function