Odoo Help

Welcome!

This community 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.

0

This domain expression is correct?

By
Carlos Llamacho
on 6/12/13, 12:57 PM 846 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.

1

Jeudy Nicolas

--Jeudy Nicolas--
1181
| 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

Hello,

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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