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.lot

Compute Method: _compute_expiration_date

Inputs Method Outputs
  • product_id
  • product_id.use_expiration_date
  • expiration_date
  • product_id.product_tmpl_id
  • product_id.product_tmpl_id.expiration_time
self.expiration_date = False
for lot in self:
            if lot.product_id.use_expiration_date and not lot.expiration_date:
                duration = lot.product_id.product_tmpl_id.expiration_time
                lot.expiration_date = datetime.datetime.now() + datetime.timedelta(days=duration)

Back to entity