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

Hi, new odoo ce user, trying to sort my issues. image below pretty much shows context precisely, i wanted to access linked Work Orders . Any ideas, huge thanks in advance.  

      

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

The better way to go about this would be to use self.env to perform the search. The code you have executes an XMLRPC event. Using self.env, your code would look like

result = self.env['mrp.workorder'].search([('production_id', '=', '3')])

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

not sure, this is best answer, but atlease i managed to solve this, by adding line below in python function :)

for xml rpc (external client)

result = models.execute_kw(db, uid, password, 'mrp.workorder', 'search', [[['production_id
...: ', '=', 3]]])

For Module Code(using self.env)


  • simple search records

relWorkOrders = self.env['mrp.workorder'].search([('production_id','=',self.id)])

  • search and read specific fields in one go (i ended up using this)

mo = self.env['mrp.workorder']

wo_fields = ['name','state','workcenter_id']

relWorkOrdersData = mo.search_read([('production_id','=',self.id)],wo_fields)

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ก.ค. 25
351
1
ก.ย. 24
2013
1
ส.ค. 24
2063
1
ม.ค. 23
3012
3
ม.ค. 23
10864