Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4237 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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



Awatar
Odrzuć
Autor

Thank you!

Powiązane posty Odpowiedzi Widoki Czynność
3
kwi 24
2114
1
wrz 23
1982
5
lip 20
5895
0
mar 17
3120
1
wrz 24
1326