Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
2378 Переглядів

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
344
1
вер. 24
2013
1
серп. 24
2059
1
січ. 23
3010
3
січ. 23
10862