Zum Inhalt springen
Menü
Sie müssen registriert sein, um mit der Community zu interagieren.
Diese Frage wurde gekennzeichnet
4350 Ansichten

created one model indent.indent transfer the material to one branch to another branch,stock picking will create for the model once validated, validated qty need to update in qty_done field in indent.indent model using compute function but im facing issue, if there are two material requested 1 st material qty done only update in both field

class IndentLine(models.Model):
_name = 'indent.line'
_description = 'Indent Lines'

@api.depends('indent_id.stock_ids.quantity_done')
def _compute_quantity_done(self):
quantity_done = 0.0
for each in self:
move_ids = self.env['stock.move'].search(
[('indent_id', '=', each.indent_id.id), ('product_id', '=', each.product_id.id),
('state', '=', 'done')])
for move_id in move_ids:
quantity_done += move_id.quantity_done
self.quantity_done = quantity_done



Please Provide the solution    


Avatar
Verwerfen
Verknüpfte Beiträge Antworten Ansichten Aktivität
1
Dez. 21
3567
1
Mai 20
3344
1
Juni 23
3188
1
Jan. 23
2970
0
Sept. 22
2682