In Odoo v10 how doe I search to establish which of my products contain a particular component?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilidad
- Inventario
- PoS
- Project
- MRP
Se marcó esta pregunta
8
Respuestas
3838
Vistas
You can try like this ,
# let xx be the id of the component to search
product_list = [] # list to pass the product having xx as the component
mrp_bom_rec = self.env['mrp.bom'].search([])
for rec in mrp_bom_rec:
bom_line = self.env['mrp.bom.line'].search([('bom_id', '=', rec.id)])
for line in bom_line:
if line.product_id == xx:
product_list.append(rec.product_tmpl_id.id)
break
# product_list will return the list of products contains the xx component
¿Le interesa esta conversación? ¡Participe en ella!
Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.
Registrarse
Hi, can you make the question some more clear ? are you looking to customize search view based on some values in the field ?
I want to find out which of my 1,000 products contain a particular component that is being discontinued. I want to render that component inactive in my db.
what you meant by component ?
I can not be more clear than the dictionary definition "a part that combines with other parts to form something bigger"
what i meant is that, is the component you are referring is BOM or not ? I thought you are a developer, sorry for misunderstanding you . Normally techies use technical terms here. To know the meaning of component i don't need your help. Its your need to get a solution not mine. And please be honest and polite in forum.
Thanks
The component in question is already in many BoMs - I just need to know how to find out which products use that component. Is there any way to search for all products that contain the component in question?
Wonderful - thank you
Also you can check the following module, this will show a smart button in the product form , which will list out the list of product in which this product is used as component.
https://www.odoo.com/apps/modules/10.0/bom_components_image/