Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
369 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona