İçereği Atla
Menü
Bu soru işaretlendi
2 Cevaplar
2358 Görünümler

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

Avatar
Vazgeç
En İyi Yanıt

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)

Avatar
Vazgeç
Üretici En İyi Yanıt

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


Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Ara 22
2778
1
Mar 22
3414
2
Mar 22
3342
0
Oca 24
1296
1
Oca 23
7176