parameters: (self)
docstring: Log an activity on internally stored lots whose alert_date has been reached.
  
          No further activity will be generated on lots whose alert_date
          has already been reached (even if the alert_date is changed).
docstring_summary: Log an activity on internally stored lots whose alert_date has been reached.
docstring_tokens: Log an activity on internally stored lots whose alert_date has been reached .
function: def _alert_date_exceeded(self):
          """Log an activity on internally stored lots whose alert_date has been reached.
  
          No further activity will be generated on lots whose alert_date
          has already been reached (even if the alert_date is changed).
          """
          alert_lots = self.env['stock.production.lot'].search([
              ('alert_date', '<=', fields.Date.today()),
              ('product_expiry_reminded', '=', False)])
  
          lot_stock_quants = self.env['stock.quant'].search([
              ('lot_id', 'in', alert_lots.ids),
              ('quantity', '>', 0),
              ('location_id.usage', '=', 'internal')])
          alert_lots = lot_stock_quants.mapped('lot_id')
  
          for lot in alert_lots:
              lot.activity_schedule(
                  'product_expiry.mail_activity_type_alert_date_reached',
                  user_id=lot.product_id.responsible_id.id or SUPERUSER_ID,
                  note=_("The alert date has been reached for this lot/serial number")
              )
          alert_lots.write({
              'product_expiry_reminded': True
          })
function_tokens: def _alert_date_exceeded ( self ) : alert_lots = self . env [ 'stock.production.lot' ] . search ( [ ( 'alert_date' , '<=' , fields . Date . today ( ) ) , ( 'product_expiry_reminded' , '=' , False ) ] ) lot_stock_quants = self . env [ 'stock.quant' ] . search ( [ ( 'lot_id' , 'in' , alert_lots . ids ) , ( 'quantity' , '>' , 0 ) , ( 'location_id.usage' , '=' , 'internal' ) ] ) alert_lots = lot_stock_quants . mapped ( 'lot_id' ) for lot in alert_lots : lot . activity_schedule ( 'product_expiry.mail_activity_type_alert_date_reached' , user_id = lot . product_id . responsible_id . id or SUPERUSER_ID , note = _ ( "The alert date has been reached for this lot/serial number" ) ) alert_lots . write ( { 'product_expiry_reminded' : True } )