4
  1. I've created a new discussion group in OpenERP 7 under messaging. I'm trying to send a notification email to all the members of the group when the status of a task is changed. I have already tried creating an automated action and linking to server action of type email. But, in server actions, how to address the particular group? The group name is supervisors.

  2. Is there a way to trigger a mail, when a particular function is called?

Tintumon M
  • 1,156
  • 2
  • 14
  • 36
user1930115
  • 995
  • 2
  • 11
  • 19
  • I am also Looking for the same kind of feature... I Need to send an email to "Purchase Managers" group, when a PO is confirmed by admin. Not getting any solution. Still fighting. Let me know if you get any luck. – vissu Apr 02 '14 at 07:32
  • hi, i found a sol, but now im not sure if you'll need it. login as user, go to messages, left side on the bottom: discussion group ->enter, you see the existing groups at the right side. create a new one, save, re-open, now you can enter an email adress (default is "group-""@yourdomainalias". enter as you wish... be sure, that the configured "incoming mail server" reads the mailbox with mails adressed to your discussion-group-mail-adreess. advantage would be to use catchall adress,and use the group's address in server action to send the emails to the group – user1930115 Apr 10 '14 at 03:17
  • Yes I know this already. But in server action what is the object we need to put? `object.partner_id` for supplier email, just like that I don't know what to put for User Group. Can you please give more details what you did in server action (Particularly "To" addresses object). – vissu Apr 10 '14 at 08:47

1 Answers1

0

I had to tackle the same, here is a snippet that I wrote:

def cron_notification(self, cr, uid, context=None):

    mail_group_obj = self.pool.get('mail.group')
    mail_group = mail_group_obj.browse(cr, uid, 4, context=context)

    body = 'sexy body'

    mail_group.message_post(body=body, subject=False, type='comment', context={
                                'default_model': 'mail.group',
                                'default_res_id': 4,
                                'mail_post_autofollow': True,
                                'mail_post_autofollow_partner_ids': [],
                            }, content_subtype='plaintext',
                            partner_ids=[],
                            attachment_ids=[],
                            subtype='mail.mt_comment'
                            )

    return

This code will send a message "sexy body" to group with id=4. Whoever should receive this message will have to follow this mail.group and set in his "preference" section to receive all Emails.

(This code should work as it is for any object similar to 'mail.group' that inherits mail.thread)

I dont know which of all those parameters are redundant as I stopped once it worked and never "optimized" it. Feel free to use this snippet wherever you want.

chickahoona
  • 1,914
  • 14
  • 23