Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I am trying to retrieve a couple of records from my table of production to perform a calculation.
So far I have this class that extends mrp.production.workcenter.line
for work_order in self.browse(cr, uid, ids, context=None):
ids_product_qty = self.pool.get('mrp.bom').search(cr, uid, ['routing_id', '=', work_order.routing_id], limit=1, context=None) ids_hour_prd = self.pool.get('mrp.routing.workcenter').search(cr, uid, ['routing_id', '=', work_order.routing_id], limit=1, context=None) product_qty_by_hour = mrp_bom_object.browse(cr, uid, ids_product_qty, context=None) hour_product = mrp_routing_workcenter_object.browse(cr, uid, ids_hour_prd, context=None) result[work_order.id] = (hour_product.hour_nbr * work_order.qty) / product_qty_by_hour.product_qty
But is not working, and in debugging it shows that the ids return empty lists. Someone has any idea why?
Thanks a lot.
For me you should use like this (you missed ".id" on your domain definition):
ids_product_qty = self.pool.get('mrp.bom').search(cr, uid, ['routing_id', '=', work_order.routing_id.id], limit=1, context=None)
I have not create a test database to check but think it'is the correct way.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 6/12/13, 12:57 PM|
|Seen: 993 times|
|Last updated: 3/16/15, 8:10 AM|