Odoo Help


[8.0] New API - Using Domains - ValueError: Invalid leaf

on 2/4/15, 7:55 AM 5,795 views

I am inheriting the action_produce method from the class mrp_production.  I want to get the quants that are reserved for each of the moves.

The beginning of my method looks like this:


    def action_produce(self, production_id, production_qty, production_mode, wiz=False, context=None):
        production = self.browse(production_id)
        domain = ['reservation_id', 'in', production.move_lines.ids]
        stock_quants_obj = self.env['stock.quant']
        quants = stock_quants_obj.search(domain)

When I get to the last line above, I get:

ValueError: Invalid leaf reservation_id

I tried using other fields that exist in stock.quant (eg ['cost','>','0']) and they all say Invalid leaf [fieldname]

Is there something wrong with how I'm getting my stock_quants_obj?



| 6 4 7
Lodz, Poland

On 2/4/15, 8:06 AM

Try this:

domain = [('reservation_id', 'in', production.move_lines.ids)]

This works! Could you explain this to me? In looking at other domains and (obviously misreading the ORM documentation), I thought that my syntax was correct.

on 2/4/15, 8:12 AM


on 2/4/15, 8:19 AM

Ah, I see! Thank you.

on 2/4/15, 8:22 AM

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 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: 2/4/15, 7:55 AM
Seen: 5795 times
Last updated: 2/16/17, 9:14 PM