I am migrating a module to version 13.0, which uses continue
in a loop inside a compute method, and an error was driving me crazy for a while.
I simplified the code to the minimum until I had this kind of nosense:
@api.depends('move_lines', 'move_lines.price_subtotal')
def _compute_subtotal(self):
for picking in self:
if picking.picking_type_id.code not in ['incoming', 'outgoing']:
continue
picking.update({
'amount_untaxed': 3.0,
})
But I was still receiving the error, which by the way was this (and only was shown when creating new pickings):
stock.picking(<NewId 0x7f5404ba5eb8>,).amount_untaxed
So I realised that the problem was the continue
statement, if I removed it, it worked. And I tried to use continue
in several loops of other compute methods of standard Odoo modules, with same result.
Until now, if you did not assign a value for a field in a computed method, it automatically took False
, so continue
was not a problem.
Does anyone experience this problem with continue
too?