Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
2441 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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)

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
gru 22
2824
1
mar 22
3450
2
mar 22
3371
0
sty 24
1314
1
sty 23
7228