Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
371 Widoki

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
   

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć