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

I want to get the latest date of intervention of a centre in a new field named "intervention_id" in a "centre" form view which is related to another menuitem named intervention that shows every centre's dates of interventions(maintenance of equipements in each center),these 2 classes are of course related with relational fields so I tried this function :

def _get_latest_intervention(self, cr, uid, ids, field_name, args, context=None):

res = {}

obj_intervention = self.pool.get('c.intervention')

for interv in self.browse(cr, uid, ids, context=context):

intervention_ids = obj_intervention.search(cr, uid, [('centre_id', '=', intervention_id)], order='date_intv', context=context)

if intervention_ids:

res[intervention_id] = intervention_ids[-1:][0]

else:

res[intervention_id] = False

return res

and it gaves me this error: would any one please tells me what could be wrong with it :

TypeError: _get_latest_intervention() takes at least 6 arguments (5 given)
อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

You could fix it like:

def _get_latest_intervention(self, cr, uid, ids, field_name, args=None, context=None):
อวตาร
ละทิ้ง
ผู้เขียน

well it didn't work it gives same error !!

Related Posts ตอบกลับ มุมมอง กิจกรรม
6
ต.ค. 20
9160
1
ส.ค. 21
62617
1
ก.ย. 20
5065
3
เม.ย. 18
31776
0
ม.ค. 16
4432