From 06287cfc2f405dce034bfd6f1fff5f48a914eb0c Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 23 Jan 2013 16:29:23 +0100 Subject: [PATCH] [IMP] Responsible change message private bzr revid: jco@openerp.com-20130123152923-iu4omw1qmmwcdfyh --- addons/account_followup/account_followup.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py index dce4c7b3561..af73ba9a35d 100644 --- a/addons/account_followup/account_followup.py +++ b/addons/account_followup/account_followup.py @@ -280,8 +280,15 @@ class res_partner(osv.osv): if vals.get("payment_responsible_id", False): for part in self.browse(cr, uid, ids, context=context): if part.payment_responsible_id <> vals["payment_responsible_id"]: - self.message_post(cr, uid, part.id, body = _('New responsible registered: %s') % (self.pool.get("res.users").browse(cr, uid, vals["payment_responsible_id"], context=context).name), - context=context) + #Find partner_id of user put as responsible + responsible_partner_id = self.pool.get("res.users").browse(cr, uid, vals['payment_responsible_id'], context=context).partner_id.id + self.pool.get("mail.thread").message_post(cr, uid, 0, + body = _("You became responsible to follow up the payment of") + " " + part.name + " ", + type='comment', + subtype="mail.mt_comment", context=context, + model='res.partner', res_id = part.id, + notified_partner_ids = [(6, 0, [responsible_partner_id])], + partner_ids = [(6, 0, [responsible_partner_id])]) res = super(res_partner, self).write(cr, uid, ids, vals, context=context) return res