Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odgovori
2408 Prikazi

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.  

      

Avatar
Opusti
Best Answer

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')])

Avatar
Opusti
Avtor Best Answer

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)

Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
jul. 25
367
1
sep. 24
2024
1
avg. 24
2088
1
jan. 23
3025
3
jan. 23
10877