跳至内容
菜单
此问题已终结
2 回复
2402 查看

Hi everyone,

For my studies, i need to retrive information from odoo to display them on a web server. To do that i'm using python 3

My issue is the following:

I can't get the article information of a fabrication order

i can get basic informations like the number, name, quantity, date... 

With this python code:


fields=['id','name','move_raw_ids','state','product_qty','qty_producing','date_planned_start'] 
mo_list=self.mModels.execute_kw(self.mErpDB,self.mUserId,self.mErpPwd,
    'mrp.production','search_read',
    [[('id','=',mo_dicoIDF)]],
    {'fields':fields})

I have this result:

[13, 'WH/MO/00013', [38, 39], 'confirmed', 1.0, 0.0, '2022-11-15 22:01:39']

But i can't get the article information on the "components" tab


Finally i want to have that: [13, 'WH/MO/00013', Palette1 1140x1140, 0.00, 1.00, Cartons2 35x31x25, 0.00, 35.00, 1.0, 0.0, '2022-11-15 22:01:39']

 

Does anyone know how to help me please?

 

I am not English so sorry if I made mistakes

Thank you for your suggestions

Corentin

形象
丢弃
最佳答案

Hi Corentin MAUDET

You can get the article information on the "components" tab like this.

for mo in mo_list:
move_raw_ids = mo.get('move_raw_ids',[])
move_raw = models.execute_kw(self.mErpDB,self.mUserId,self.mErpPwd,'stock.move','search_read',[[('id','in',move_raw_ids)]],{'fields':['product_id']})
print('\n move_raw',move_raw)

形象
丢弃
编写者 最佳答案

Hello

It works, thanks a lot!!

I have another question, now i get that:

move_raw=====> [{'id': 26, 'product_id': [6, 'Palette3 1200x800']}, {'id': 27, 'product_id': [7, 'Cartons4 57x45x45']}]


I use this code:

for mo_dico2 in move_raw:
    self.mListArticles.clear()
    for X in mo_dico2.keys():
        print(f'mo_dico2====>{mo_dico2}')
        self.mListOFArticle.append(mo_dico2[X])
self.mListArticles.append(self.mListOFArticle.copy())
And i get thas:
mo_dico2====>{'id': 26, 'product_id': [6, 'Palette3 1200x800']}

How can i just get 'Palette3 1200x800' ?

 

Thanks


形象
丢弃
相关帖文 回复 查看 活动
1
12月 22
2801
1
3月 22
3440
2
3月 22
3360
0
1月 24
1303
1
1月 23
7202