Odoo Help


This domain expression is correct?

Carlos Llamacho
on 6/12/13, 12:57 PM 1,130 views

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.


Jeudy Nicolas

--Jeudy Nicolas--

| 6 7 8
Pelousey, France
--Jeudy Nicolas--

- Linux administrator - Functional guy with OpenERP - Python, html, css, javascript developer OpenERP Ready Partner

Jeudy Nicolas
On 6/12/13, 2:01 PM


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.

Great, this worked. But why is this? work_order.routing_id should not bring me the value of the record routing_id in my database? Why the need for the .id at the end?

Carlos Llamacho
on 6/12/13, 5:09 PM

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/12/13, 12:57 PM
Seen: 1130 times
Last updated: 3/16/15, 8:10 AM