Good Morning I am trying to send email to multiple user. I found the function get_users_from_groups
How can I write the function get_users_email? Is correct the function get_users_from_groups?
Have a nice day
def get_users_from_groups(self,group_id):
How can I write the function get_users_email? Is correct the function get_users_from_groups?
Have a nice day
def get_users_from_groups(self,group_id):
users_ids = []
sql_query = """select uid from res_groups_users_rel where gid = %s"""
params = (group_id,)
self.env.cr.execute(sql_query, params)
results = self.env.cr.fetchall()
for users_id in results:
users_ids.append(users_id[0])
return users_ids
# def get_users_email(self,group_id, user_ids)
def get_groups_usesr_email(self):
emails = []
user_ids = self.get_users_from_groups('group_sprogroup_purchase_request_manager')
emails = self.get_users_email('group_sprogroup_purchase_request_manager', user_ids)
user_ids = self.get_users_from_groups('group_sprogroup_purchase_request_leader')
new_emails = self.get_users_email('group_sprogroup_purchase_request_leader', user_ids)
for email in new_emails:
emails.append(email)
return emails
Hope this will resolve your issue: https://goo.gl/z16PBZ