Skip to Content
Menu
This question has been flagged
1 Odpoveď
366 Zobrazenia

class StockMoveLine(models.Model):  

  _inherit = "stock.move.line" 

  to_con = fields.Float(related='move_id.product_uom_qty', store=True)   

 actual = fields.Float(related='move_id.quantity_done', store=True, string='actual')

  diffrent = fields.Integer (string='diffrent', compute='_compute_due_dif', store=True)


     @api.depends('to_con', 'actual')
    def _compute_due_dif(self):
        for record in self:
            if record.to_con:
                dif = record.to_con - record.actual
                record.diffrent = dif
   

Avatar
Zrušiť
Best Answer

Hi,


If the above is not working just change the dependency of the compute function to move_id.product_uom_qty and move_id.quantity_done and see it is makes any difference. Instead of taking this values from the move, you have similar fields available in move line also.

Thanks

Avatar
Zrušiť