Skip to Content
मेन्यू
This question has been flagged
1 Reply
4221 Views

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
Discard
Best Answer

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
Discard
Author

Thank you!

Related Posts Replies Views Activity
3
अप्रैल 24
2108
1
सित॰ 23
1975
5
जुल॰ 20
5890
0
मार्च 17
3090
1
सित॰ 24
1324