[IMP]: Change warning message if login user is not an employee and try to post internal note

bzr revid: aja@tinyerp.com-20130927094215-nf4mvdkz4mqr7543
This commit is contained in:
ajay javiya (OpenERP) 2013-09-27 15:12:15 +05:30
parent 6b4a1a3d55
commit 46fdb4ee83
3 changed files with 2 additions and 10 deletions

View 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.

View 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'}

View 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)