Browse Source

[MRG] [ADD] mail_client_view: gives normal users access to the mail views.

The only other possibilities users have of looking at e-mails, is through the
partner object, or other objects mails are directly linked to. This makes it
impossible to get an overall view, or to search through mails.

Furthermore the module makes newly received mails stand out with a red circle
in the mail view. These mails are in need of action. Via a simple click a user
can either mark a message as also in need of action, or the other way around,
as having been handled.
pull/78/head
unknown 12 years ago
committed by Alexandre Fayolle
parent
commit
cc64275169
  1. 22
      mail_client_view/__init__.py
  2. 48
      mail_client_view/__openerp__.py
  3. 1
      mail_client_view/model/__init__.py
  4. 39
      mail_client_view/model/mail_message.py
  5. 11
      mail_client_view/view/mail_user_menu.xml
  6. 98
      mail_client_view/view/mail_user_view.xml

22
mail_client_view/__init__.py

@ -0,0 +1,22 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Therp BV (<http://therp.nl>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import model

48
mail_client_view/__openerp__.py

@ -0,0 +1,48 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2013 Therp BV (<http://therp.nl>)
# All Rights Reserved
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': 'User email access',
'version': '6.1.r0025',
'description': '''
Adds a menu to the customer address book that enables ordinary users to
look at customer or other mail. Also adds an 'action needed' boolean to
mail messages, to quickly select all mails that still have to be acted on.
The action_needed flag will be shown to users in a tree view as a red
circle, no action needed will be green. In a form users either have the
button 'confirm action done' (if action needed), or the button 'set
action needed.
''',
'author': 'Therp BV',
'website': 'http://www.therp.nl',
'category': 'Tools',
'depends': ['mail'],
'data': [
'view/mail_user_menu.xml',
'view/mail_user_view.xml',
],
'js': [],
'installable': True,
'active': False,
'certificate': '',
}

1
mail_client_view/model/__init__.py

@ -0,0 +1 @@
import mail_message

39
mail_client_view/model/mail_message.py

@ -0,0 +1,39 @@
# -*- coding: UTF-8 -*-
'''
Created on 16 apr. 2013
@author: Therp BV
http://www.therp.nl
'''
from openerp.osv.orm import Model
from openerp.osv import fields
class mail_message(Model):
'''Extend mail_message with action_needed flag'''
_inherit = 'mail.message'
def set_action_needed_off(self, cr, user, ids, context=None):
self.write(cr, user, ids, {'action_needed': False}, context=context)
return True
def set_action_needed_on(self, cr, user, ids, context=None):
self.write(cr, user, ids, {'action_needed': True}, context=context)
return True
def create(self, cr, user, vals, context=None):
# Set newly received messages as needing action, unless an
# explicit value for action_needed has been passed.
if ((not 'action_needed' in vals)
and ('state' in vals) and (vals['state'] == 'received')):
vals['action_needed'] = True
mm_id = super(mail_message, self).create(
cr, user, vals, context=context)
return mm_id
_columns = {
'action_needed': fields.boolean('Action needed',
help='Action needed is True whenever a new mail is received, or'
' when a user flags a message as needing attention.'),
}

11
mail_client_view/view/mail_user_menu.xml

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<openerp>
<data>
<menuitem
id="mail_user_menu"
name="Messages"
parent="base.menu_address_book"
action="mail.action_view_mail_message"
sequence="80" />
</data>
</openerp>

98
mail_client_view/view/mail_user_view.xml

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record
id="view_mail_action_needed_search"
model="ir.ui.view">
<field name="name">view_mail_action_needed_search</field>
<field name="model">mail.message</field>
<field
name="inherit_id"
ref="mail.view_email_message_search" />
<field
name="arch"
type="xml">
<data>
<field
name="email_from"
position="before">
<separator orientation="vertical"/>
<filter
icon="terp-check"
name="action"
string="Action needed"
domain="[('action_needed','=',True)]" />
</field>
</data>
</field>
</record>
<record
id="view_mail_action_needed_tree"
model="ir.ui.view">
<field name="name">view_mail_action_needed_tree</field>
<field name="model">mail.message</field>
<field
name="inherit_id"
ref="mail.view_email_message_tree" />
<field
name="arch"
type="xml">
<data>
<field
name="state"
position="after">
<field
name="action_needed"
invisible="True" />
<button
name="set_action_needed_off"
attrs="{'invisible': [('action_needed','=',False)]}"
string="confirm action done"
icon="gtk-no"
type="object" />
<button
name="set_action_needed_on"
attrs="{'invisible': [('action_needed','=',True)]}"
string="set action needed"
icon="gtk-yes"
type="object" />
</field>
</data>
</field>
</record>
<record
id="view_mail_action_needed_form"
model="ir.ui.view">
<field name="name">view_mail_action_needed_form</field>
<field name="model">mail.message</field>
<field
name="inherit_id"
ref="mail.view_email_message_form" />
<field
name="arch"
type="xml">
<data>
<button
name="%(mail.action_email_compose_message_wizard)d"
position="after">
<field
name="action_needed"
invisible="True" />
<button
name="set_action_needed_off"
attrs="{'invisible': [('action_needed','=',False)]}"
string="confirm action done"
icon="gtk-no"
type="object" />
<button
name="set_action_needed_on"
attrs="{'invisible': [('action_needed','=',True)]}"
string="set action needed"
icon="gtk-yes"
type="object" />
</button>
</data>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save