تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4197 أدوات العرض

I need to override dispatch_rpc function in server/openerp/netsvc.py to add code that sends error log by email. I have a function that do it and works, but I want to be able to apply this modification in future by applying a module with this. Thanks :)

PD. dispatch_rpc function is not part of any class, how can I inherit it?

الصورة الرمزية
إهمال
أفضل إجابة


This is pretty straight forward but you need to do a couple of things (assuming OpenERP 7)

1 Create your new module.

2 Create a class that inherits osv.Model

3 Add an _inherit = 'xxxxxxx'

4 Implement your new dispatch_rpc function.

5 Install your module and it should work.

A typical pattern is to call super and then process the results.


class MyModel(osv.Model):

_inherit = 'sale.order.line'

def product_id_change(self, cr, uid, ids, ...):

res = super(MyModel, self).product_id_change(cr, uid, ids...)

# do stuff with res.

return res

Here is an other useful link:

Regards.

الصورة الرمزية
إهمال
الكاتب

thanks for your answer, but dispatch_rpc is not part of any class or module, is part from base, what can I inherit?

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مايو 19
9094
1
مارس 15
5464
1
أبريل 20
2804
2
يناير 24
16156
1
يوليو 15
4434