Skip to Content
Menu
This question has been flagged
1 Reply
2918 Views
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):

        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
Avatar
Discard

Hope this will resolve your issue: https://goo.gl/z16PBZ

Related Posts Replies Views Activity
4
May 24
10077
1
Apr 24
1566
0
Nov 23
525
1
Sep 23
571
2
Aug 23
2427