Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
2448 Представления

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


Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
дек. 22
2832
1
мар. 22
3459
2
мар. 22
3379
0
янв. 24
1316
1
янв. 23
7244