Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
6217 Lượt xem

Hi everybody,

I want to inherit message_new method of sale.order Sale.order inherit from mail.thread (my.object -> sale.order -> mail.thread), so I was expected to simply add a method in my object which call a super(), but when I try to debug it, I never pass in my method.

There is a sample of my code:

class sale_order(osv.osv):
    _inherit = 'sale.order'

def message_new(self, cr, uid, msg_dict, custom_values=None, context=None):
    res = super(sale_order, self).message_new(cr, uid, msg_dict, custom_values, context)
    return res

I put it in a new module.

In mail_thread.py a comment says:

Inheriting classes are not required to implement any method, as the default implementation will work for any model. However it is common to override at least the message_new and message_update methods (calling super) to add model-specific behavior at creation and update of a thread when processing incoming emails.

What I did wrong? How I can modify the thread behavior, for example to modify the message "Document created"?

Thanks.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Are you sure, that your module loads? Since it uses multiple inheritance you should get error message saying that: '_name is mandatory in case of multiple inheritance'. Have you added Sale module to your dependencies?

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
4
thg 3 24
3644
1
thg 10 23
5540
0
thg 6 23
2788
1
thg 6 22
6836
0
thg 11 21
1460