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

Hi!

I try to overload a method in point_of_sale module in a custom module.

class pos_order(osv.osv):
_inherit = 'pos.order'

def onchange_partner_id(self, cr, uid, ids, part=False, context=None):
if not part:
return {value: {}}
res = super(pos_order, self).onchange_partner_id(cr, uid, ids, part=part, context=context)
        return res

 With this code, I have this error:

RuntimeError: maximum recursion depth exceeded while calling a Python object


Why?

อวตาร
ละทิ้ง
ผู้เขียน

OK. I'd declared my inherited class twice in my custom module. If I overload the onchange_partner_id method in first, it doesn't work. If I overload it in the second one, it's ok.

คำตอบที่ดีที่สุด

What you can try to do is : changing the name of your class from :

pos_order to something like my_pos_order

So that when you call your super method

res = super(pos_order, self).onchange_partner_id(cr, uid, ids, part=part, context=context)  

it's not ambigous

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

Hi Artemis!

Thanks for the answer. But I think @api.model usage is not available in 7.0 version, isn't it?

I tried and it seems no. :-(


อวตาร
ละทิ้ง

Ok, so, you're using the version 7.0 of Odoo ... well I don't really know what you can do then ...

Related Posts ตอบกลับ มุมมอง กิจกรรม
Python "super" - function does not work แก้ไขแล้ว
2
ธ.ค. 22
12644
3
ก.พ. 16
5694
1
มี.ค. 15
11337
2
พ.ค. 25
1114
0
ต.ค. 24
1035