[IMP]: Change warning message if login user is not an employee and try to post intern...
authorajay javiya (OpenERP) <aja@tinyerp.com>
Fri, 27 Sep 2013 09:42:15 +0000 (15:12 +0530)
committerajay javiya (OpenERP) <aja@tinyerp.com>
Fri, 27 Sep 2013 09:42:15 +0000 (15:12 +0530)
bzr revid: aja@tinyerp.com-20130927094215-nf4mvdkz4mqr7543

addons/mail/mail_thread.py
addons/mail/wizard/mail_compose_message.py
addons/portal/mail_message.py

index 9e0fc96..67746a6 100644 (file)
@@ -1314,12 +1314,6 @@ class mail_thread(osv.AbstractModel):
                 "Invalid thread_id; should be 0, False, an ID or a list with one ID"
         if isinstance(thread_id, (list, tuple)):
             thread_id = thread_id[0]
-            
-        #check login user is employee
-        #raise error on comment message if user is not employee
-        employee = self._check_user_is_employee(cr, uid, context=context)
-        if not employee and type == 'comment':
-            raise orm.except_orm(_('Warning'),_('Oops! Something went wrong, You are not allowed to post a note.'))
 
         # if we're processing a message directly coming from the gateway, the destination model was
         # set in the context.
index 574edbe..f129e5b 100644 (file)
@@ -271,7 +271,7 @@ class mail_compose_message(osv.TransientModel):
                         context = dict(context,
                                        mail_notify_force_send=False,  # do not send emails directly but use the queue instead
                                        mail_create_nosubscribe=True)  # add context key to avoid subscribing the author
-                    active_model_pool.message_post(cr, uid, [res_id], type='email', subtype=subtype, context=context, **mail_values)
+                    active_model_pool.message_post(cr, uid, [res_id], type='comment', subtype=subtype, context=context, **mail_values)
 
         return {'type': 'ir.actions.act_window_close'}
 
index d6a38f2..e799343 100644 (file)
@@ -50,8 +50,6 @@ class mail_message(osv.Model):
         if group_user_id not in [group.id for group in group_ids]:
             cr.execute('SELECT DISTINCT id FROM "%s" WHERE type = %%s AND subtype_id IS NULL AND id = ANY (%%s)' % (self._table), ('comment', ids,))
             if cr.fetchall():
-                raise orm.except_orm(_('Access Denied'),
-                        _('The requested operation cannot be completed due to security restrictions. Please contact your system administrator.\n\n(Document type: %s, Operation: %s)') % \
-                        (self._description, operation))
+                raise orm.except_orm(_('Warning'),_('Oops! Something went wrong, You are not allowed to post a note.'))
 
         return super(mail_message, self).check_access_rule(cr, uid, ids=ids, operation=operation, context=context)