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

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...

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

Example:

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


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

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

أفضل إجابة

HI,

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

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

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

Thanks.

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
7
نوفمبر 23
8729
1
مايو 17
3126
2
مارس 19
10967
19
مايو 24
96488
3
سبتمبر 16
3321