Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
2334 Tampilan

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
Buang
Jawaban Terbai

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
Buang
Penulis Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
1
Des 22
2751
1
Mar 22
3378
2
Mar 22
3299
0
Jan 24
1262
1
Jan 23
7108