Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
4225 Vistas

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
Descartar
Mejor respuesta

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
Descartar
Autor

Thank you!

Publicaciones relacionadas Respuestas Vistas Actividad
3
abr 24
2109
1
sept 23
1975
5
jul 20
5890
0
mar 17
3093
1
sept 24
1324