Generation

generate functionWed, 26 Apr 2023

buscar la mail.activity que se envía al usuario que va a aprobar

# Get current user user_id = context.getUser() # Get the user's mail user_mail = user_id.getProperty('email') # Get all mail.activity that are asigned to the current user mail_activity_list = self.env['mail.activity'].search([('user_id', '=', user_id.id)]) # Iterate over mail.activity list and return the one that contains the current user's mail for mail_activity in mail_activity_list: if ('<div>' + user_mail + '</div>') in mail_activity.note: return mail_activity

Want to kickstart your project?Use the new AI Studio to create your code