Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
3 ตอบกลับ
3938 มุมมอง

Hi everyone,

Im trying to override a method that was already overridden in other own model. What happens is that i set a breaking point in my method but it does not in into the method.

The code in the model A:

@api.multi
def action_state_approve(self):
for state in self:
state.state = 'approved'

So in my other Model is where Im trying to override the above method:

class ClassB(models.Model):
_inherit = 'sale.order'

@api.multi
def action_state_approve(self):
super(ClassB, self).action_state_approve()
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Hi.

Do you have set the inheritted function model in your __openerp__.py file?

You have to declare it in the depends key.

Kind regards.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

return super(ClassB, self).action_state_approve()

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Dear Osmani

Try to override by using Super Class Like This:

   @api.multi
def action_state_approve(self):
res= super(ClassB,self).action_state_approve()
...........
return res

I hope I helped you ...
อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
2
มิ.ย. 15
3821
0
เม.ย. 24
1853
4
พ.ย. 23
5946
0
ต.ค. 23
1714
Create function problem แก้ไขแล้ว
2
มิ.ย. 23
2238