İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
4242 Görünümler

Hello I'm using Odoo 13 Community Version.

 

I created automated actions to create a routing and a bom, when i create a new product. 

Now i want that the routing should have the name from the product, that works so far.

 

But I also want that the routing field in the BOM, from the product, has automatically the routing with the created product name.

 

So the routing field needs to have the routing with the name that is the same as the product name.


How can I archive this? Maybe also in the automated action with a python expression?

Avatar
Vazgeç
En İyi Yanıt

HI,

If you are creating the Routing and BOM from the automated action, you can easily assign the routing to BOM if you use Python Expression. While creating the routing you can assign it to a variable and that variable will have the value like mrp.routing(5) , so using .id you can get the id of the newly created routing.


Then while creating Bill of Materials you can pass this ID.


See the Below Sample,



Python Code:
routing = env['mrp.routing'].create({"name": record.name})
bom = env['mrp.bom'].create(
{"product_tmpl_id": record.product_tmpl_id.id, "routing_id": routing.id, "type": 'normal'})


Thanks



Avatar
Vazgeç
Üretici

Thank you!

İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Nis 24
2120
1
Eyl 23
1983
5
Tem 20
5899
0
Mar 17
3125
1
Eyl 24
1326