From 445a8bfe51f3c0eea7c6badcc03621617f9cc59e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 29 Mar 2012 12:11:13 +0200 Subject: [PATCH] [IMP] res.users in mail: added a welcome message when creating a new user. A broadcasting mechanism will be necessaryu though. bzr revid: tde@openerp.com-20120329101113-5qg2hqbdawln56yh --- addons/mail/res_users.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/mail/res_users.py b/addons/mail/res_users.py index db0f4ac89b8..f5de133c607 100644 --- a/addons/mail/res_users.py +++ b/addons/mail/res_users.py @@ -45,8 +45,13 @@ class res_users(osv.osv): def create(self, cr, uid, data, context=None): user_id = super(res_users, self).create(cr, uid, data, context=context) + user = self.browse(cr, uid, [user_id], context=context)[0] # make user follow itself self.message_subscribe(cr, uid, [user_id], [user_id], context=context) + # create a welcome message to broadcast + company_name = user.company_id.name if user.company_id else 'the company' + message = _('%s has joined %s! You may leave him a message to celebrate his arrival and help him doing its first steps !') % (user.name, company_name) + self.message_append_note(cr, uid, [user.id], 'Welcome notification', message, context=context) return user_id def message_load_ids(self, cr, uid, ids, limit=100, offset=0, domain=[], ascent=False, root_ids=[False], context=None):