تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
12311 أدوات العرض

Who can help me with the solution?
I'm trying to create the following proces:
When I create a new product with a specific product category, the automatic action should duplicate an existing Bill of Material and link that the the new product.
So, dependent on the product category, an specific BoM should be created by duplicating an existing BoM together with all the components.
Thanks you in advance for your help
Cheers
Maarten

الصورة الرمزية
إهمال

Thank you very much Jake! This works. 

أفضل إجابة

If you make an automated action on the product.template create, and execute python code. You can use  the following code:

if record.categ_id.id == 111:
    env['mrp.bom'].browse(113).copy({'product_tmpl_id': record.id})

You will just need to replace the 111 and 113 with the IDs that you want, and if you want different BoMs for different categories just copy and paste underneath.

الصورة الرمزية
إهمال
الكاتب أفضل إجابة

Thanks you very much, 

Based on your information your provided, I made a automated action, which triggered on product.template creation with the python code: 

env['mrp.routing'].browse(record.x_ProductionRouting.id).copy({'x_product_template':record.id})

The field x_ProductionRouting.id I created on  product_template for the purpose the user can select the an record of mrp.routing and is being duplicated by the python code. 

But now I'm trying to get the new created routing id (with is duplicated) and put that ID back on the field ProductionRouting  (product.template).

Is that possible?

الصورة الرمزية
إهمال

What are you trying to do?

By the way, it's not normally a good idea to ask a new question like this. It will probably get a quicker response if you create a new question!

المنشورات ذات الصلة الردود أدوات العرض النشاط
2
يناير 22
1290
0
يونيو 21
2393
2
يونيو 20
4428
0
يونيو 15
2822
1
مارس 15
3428