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

I need to fix a bug in a community module. However, calling SUPER will always cause the error to be thrown.

Using osv I can do something like...

osv.osv.write(self, cr, uid, ids, vals, context=context)

This will ignore any other changes to write().


How can we do this using the new API? It's a big method and I don't feel like rewriting it using the old API...

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

Example:

@api.multi    
def unlink(self):
        ...
        return models.Model.unlink(self)


Ảnh đại diện
Huỷ bỏ
Tác giả

I had already tried that but it didn't work. Here's why: one needs to add the "self"...

xpto = models.Model.write(self,vals)

Just as in my example

Câu trả lời hay nhất

HI,

please try models.Model.write(self, vals) if you are using any decorators like @api.multi

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

I'm not contradicting you, I'm emphasizing why it wasn't working.

Thanks.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
7
thg 11 23
8750
1
thg 5 17
3134
2
thg 3 19
10977
19
thg 5 24
96509
3
thg 9 16
3331