Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Products Expiration Date

Entity: stock.move.line

Compute Method: _compute_expiration_date

Inputs Method Outputs
  • quant_id
  • quant_id.lot_id
  • lot_id
  • picking_type_use_create_lots
  • product_id
  • product_id.use_expiration_date
  • expiration_date
  • picking_id
  • picking_id.scheduled_date
  • product_id.expiration_time
for move_line in self:
            if lot_id := move_line.quant_id.lot_id or move_line.lot_id:
                move_line.expiration_date = lot_id.expiration_date
            elif move_line.picking_type_use_create_lots:
                if move_line.product_id.use_expiration_date:
                    if not move_line.expiration_date:
                        from_date = move_line.picking_id.scheduled_date or fields.Datetime.today()
                        move_line.expiration_date = from_date + datetime.timedelta(days=move_line.product_id.expiration_time)
                else:
                    move_line.expiration_date = False

Back to entity