Welcome!

This community is for professionals and enthusiasts of our products and services. Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

0

0
Avatar

Maarten Bressers

--Maarten Bressers--

2546
| 3 1 2
Oisterwijk, Nederland
--Maarten Bressers--
Maarten Bressers
Op 06-10-20 09:18

Credit to Jake Robinson for this tip, which automatically creates a BOM for new items:

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

Notes:

  1. The “apply on” means that it will not create a BOM for service items.
  2. Selection by product category is done in the Python code.
    • You need to know the record IDs of the product category and the BOM you will be copying (in this case the product category id is 6 and the BOM we are copying is record 1).
  3. You could easily have different BOM templates for different product categories:
if record.categ_id.id == 6:
     env['mrp.bom'].browse(1).copy({'product_tmpl_id': record.id}) 
if record.categ_id.id == 7:
     env['mrp.bom'].browse(2).copy({'product_tmpl_id': record.id})   

Blijf geïnformeerd

Over deze community

This is a forum for internal use only... Lees de regels

Vraag hulpmiddelen

3 volger(s)

Statistieken

Gevraagd: 06-10-20 09:17
Gezien: 25 keer
Laatst bijgewerkt: 06-10-20 09:18