Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
5 Antwoorden
22359 Weergaven

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:

 

    @api.model
    @api.depends('move_created_ids')
    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']
        pdb.set_trace()
        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?

Avatar
Annuleer
Beste antwoord

Try this:

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

Avatar
Annuleer
Auteur

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.

https://media.readthedocs.org/pdf/odoo-new-api-guide-line/latest/odoo-new-api-guide-line.pdf

Auteur

Ah, I see! Thank you.

Beste antwoord

This Works. for me

scores = results.search([('category', '=', 'Division 3')])
try this
domain =

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


Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
dec. 23
30950
6
jan. 18
32796
1
aug. 15
6823
0
mrt. 15
6382
1
aug. 25
301