콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
2244 화면

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)

아바타
취소
관련 게시물 답글 화면 활동
1
7월 25
240
1
9월 24
1847
1
8월 24
1947
1
1월 23
2933
3
1월 23
10706