Merge lp:~therp-nl/server-env-tools/6.1-email_client_view into lp:~server-env-tools-core-editors/server-env-tools/6.1

Proposed by Ronald Portier (Therp)
Status: Merged
Merged at revision: 34
Proposed branch: lp:~therp-nl/server-env-tools/6.1-email_client_view
Merge into: lp:~server-env-tools-core-editors/server-env-tools/6.1
Diff against target: 252 lines (+219/-0)
6 files modified
mail_client_view/__init__.py (+22/-0)
mail_client_view/__openerp__.py (+48/-0)
mail_client_view/model/__init__.py (+1/-0)
mail_client_view/model/mail_message.py (+39/-0)
mail_client_view/view/mail_user_menu.xml (+11/-0)
mail_client_view/view/mail_user_view.xml (+98/-0)
To merge this branch: bzr merge lp:~therp-nl/server-env-tools/6.1-email_client_view
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Approve
Server Environment And Tools Core Editors Pending
Review via email: mp+159508@code.launchpad.net

This proposal supersedes a proposal from 2013-04-16.

Description of the change

This merge adds a new module, mail_client_view, that will gave normal users (that do not have access to the settings/configuration menu), 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.

To post a comment you must log in.
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote : Posted in a previous version of this proposal

Two nits:

l.109,113: the 'args' argument is the context. Please pass it on to the write method for a correct translation of any user errors that may occur.

l.105 Regardless of its usage in the core OpenERP code, osv.osv is deprecated and should be replaced by orm.Model.

LGMT otherwise.

review: Needs Fixing
Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

I made the requested changes.

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Thanks!

review: Approve
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : Posted in a previous version of this proposal

LGTM

review: Approve (code review, no test)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'mail_client_view'
2=== added file 'mail_client_view/__init__.py'
3--- mail_client_view/__init__.py 1970-01-01 00:00:00 +0000
4+++ mail_client_view/__init__.py 2013-04-17 21:59:28 +0000
5@@ -0,0 +1,22 @@
6+# -*- encoding: utf-8 -*-
7+##############################################################################
8+#
9+# OpenERP, Open Source Management Solution
10+# This module copyright (C) 2013 Therp BV (<http://therp.nl>)
11+# All Rights Reserved
12+#
13+# This program is free software: you can redistribute it and/or modify
14+# it under the terms of the GNU Affero General Public License as
15+# published by the Free Software Foundation, either version 3 of the
16+# License, or (at your option) any later version.
17+#
18+# This program is distributed in the hope that it will be useful,
19+# but WITHOUT ANY WARRANTY; without even the implied warranty of
20+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21+# GNU Affero General Public License for more details.
22+#
23+# You should have received a copy of the GNU Affero General Public License
24+# along with this program. If not, see <http://www.gnu.org/licenses/>.
25+#
26+##############################################################################
27+import model
28
29=== added file 'mail_client_view/__openerp__.py'
30--- mail_client_view/__openerp__.py 1970-01-01 00:00:00 +0000
31+++ mail_client_view/__openerp__.py 2013-04-17 21:59:28 +0000
32@@ -0,0 +1,48 @@
33+# -*- encoding: utf-8 -*-
34+##############################################################################
35+#
36+# OpenERP, Open Source Management Solution
37+# This module copyright (C) 2013 Therp BV (<http://therp.nl>)
38+# All Rights Reserved
39+#
40+# This program is free software: you can redistribute it and/or modify
41+# it under the terms of the GNU Affero General Public License as
42+# published by the Free Software Foundation, either version 3 of the
43+# License, or (at your option) any later version.
44+#
45+# This program is distributed in the hope that it will be useful,
46+# but WITHOUT ANY WARRANTY; without even the implied warranty of
47+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48+# GNU Affero General Public License for more details.
49+#
50+# You should have received a copy of the GNU Affero General Public License
51+# along with this program. If not, see <http://www.gnu.org/licenses/>.
52+#
53+##############################################################################
54+
55+{
56+ 'name': 'User email access',
57+ 'version': '6.1.r0025',
58+ 'description': '''
59+ Adds a menu to the customer address book that enables ordinary users to
60+ look at customer or other mail. Also adds an 'action needed' boolean to
61+ mail messages, to quickly select all mails that still have to be acted on.
62+
63+ The action_needed flag will be shown to users in a tree view as a red
64+ circle, no action needed will be green. In a form users either have the
65+ button 'confirm action done' (if action needed), or the button 'set
66+ action needed.
67+ ''',
68+ 'author': 'Therp BV',
69+ 'website': 'http://www.therp.nl',
70+ 'category': 'Tools',
71+ 'depends': ['mail'],
72+ 'data': [
73+ 'view/mail_user_menu.xml',
74+ 'view/mail_user_view.xml',
75+ ],
76+ 'js': [],
77+ 'installable': True,
78+ 'active': False,
79+ 'certificate': '',
80+}
81
82=== added directory 'mail_client_view/model'
83=== added file 'mail_client_view/model/__init__.py'
84--- mail_client_view/model/__init__.py 1970-01-01 00:00:00 +0000
85+++ mail_client_view/model/__init__.py 2013-04-17 21:59:28 +0000
86@@ -0,0 +1,1 @@
87+import mail_message
88
89=== added file 'mail_client_view/model/mail_message.py'
90--- mail_client_view/model/mail_message.py 1970-01-01 00:00:00 +0000
91+++ mail_client_view/model/mail_message.py 2013-04-17 21:59:28 +0000
92@@ -0,0 +1,39 @@
93+# -*- coding: UTF-8 -*-
94+'''
95+Created on 16 apr. 2013
96+
97+@author: Therp BV
98+
99+http://www.therp.nl
100+'''
101+from openerp.osv.orm import Model
102+from openerp.osv import fields
103+
104+
105+class mail_message(Model):
106+ '''Extend mail_message with action_needed flag'''
107+ _inherit = 'mail.message'
108+
109+ def set_action_needed_off(self, cr, user, ids, context=None):
110+ self.write(cr, user, ids, {'action_needed': False}, context=context)
111+ return True
112+
113+ def set_action_needed_on(self, cr, user, ids, context=None):
114+ self.write(cr, user, ids, {'action_needed': True}, context=context)
115+ return True
116+
117+ def create(self, cr, user, vals, context=None):
118+ # Set newly received messages as needing action, unless an
119+ # explicit value for action_needed has been passed.
120+ if ((not 'action_needed' in vals)
121+ and ('state' in vals) and (vals['state'] == 'received')):
122+ vals['action_needed'] = True
123+ mm_id = super(mail_message, self).create(
124+ cr, user, vals, context=context)
125+ return mm_id
126+
127+ _columns = {
128+ 'action_needed': fields.boolean('Action needed',
129+ help='Action needed is True whenever a new mail is received, or'
130+ ' when a user flags a message as needing attention.'),
131+ }
132
133=== added directory 'mail_client_view/view'
134=== added file 'mail_client_view/view/mail_user_menu.xml'
135--- mail_client_view/view/mail_user_menu.xml 1970-01-01 00:00:00 +0000
136+++ mail_client_view/view/mail_user_menu.xml 2013-04-17 21:59:28 +0000
137@@ -0,0 +1,11 @@
138+<?xml version="1.0"?>
139+<openerp>
140+ <data>
141+ <menuitem
142+ id="mail_user_menu"
143+ name="Messages"
144+ parent="base.menu_address_book"
145+ action="mail.action_view_mail_message"
146+ sequence="80" />
147+ </data>
148+</openerp>
149\ No newline at end of file
150
151=== added file 'mail_client_view/view/mail_user_view.xml'
152--- mail_client_view/view/mail_user_view.xml 1970-01-01 00:00:00 +0000
153+++ mail_client_view/view/mail_user_view.xml 2013-04-17 21:59:28 +0000
154@@ -0,0 +1,98 @@
155+<?xml version="1.0" encoding="utf-8"?>
156+<openerp>
157+ <data>
158+ <record
159+ id="view_mail_action_needed_search"
160+ model="ir.ui.view">
161+ <field name="name">view_mail_action_needed_search</field>
162+ <field name="model">mail.message</field>
163+ <field
164+ name="inherit_id"
165+ ref="mail.view_email_message_search" />
166+ <field
167+ name="arch"
168+ type="xml">
169+ <data>
170+ <field
171+ name="email_from"
172+ position="before">
173+ <separator orientation="vertical"/>
174+ <filter
175+ icon="terp-check"
176+ name="action"
177+ string="Action needed"
178+ domain="[('action_needed','=',True)]" />
179+ </field>
180+ </data>
181+ </field>
182+ </record>
183+ <record
184+ id="view_mail_action_needed_tree"
185+ model="ir.ui.view">
186+ <field name="name">view_mail_action_needed_tree</field>
187+ <field name="model">mail.message</field>
188+ <field
189+ name="inherit_id"
190+ ref="mail.view_email_message_tree" />
191+ <field
192+ name="arch"
193+ type="xml">
194+ <data>
195+ <field
196+ name="state"
197+ position="after">
198+ <field
199+ name="action_needed"
200+ invisible="True" />
201+ <button
202+ name="set_action_needed_off"
203+ attrs="{'invisible': [('action_needed','=',False)]}"
204+ string="confirm action done"
205+ icon="gtk-no"
206+ type="object" />
207+ <button
208+ name="set_action_needed_on"
209+ attrs="{'invisible': [('action_needed','=',True)]}"
210+ string="set action needed"
211+ icon="gtk-yes"
212+ type="object" />
213+ </field>
214+ </data>
215+ </field>
216+ </record>
217+ <record
218+ id="view_mail_action_needed_form"
219+ model="ir.ui.view">
220+ <field name="name">view_mail_action_needed_form</field>
221+ <field name="model">mail.message</field>
222+ <field
223+ name="inherit_id"
224+ ref="mail.view_email_message_form" />
225+ <field
226+ name="arch"
227+ type="xml">
228+ <data>
229+ <button
230+ name="%(mail.action_email_compose_message_wizard)d"
231+ position="after">
232+ <field
233+ name="action_needed"
234+ invisible="True" />
235+ <button
236+ name="set_action_needed_off"
237+ attrs="{'invisible': [('action_needed','=',False)]}"
238+ string="confirm action done"
239+ icon="gtk-no"
240+ type="object" />
241+ <button
242+ name="set_action_needed_on"
243+ attrs="{'invisible': [('action_needed','=',True)]}"
244+ string="set action needed"
245+ icon="gtk-yes"
246+ type="object" />
247+ </button>
248+ </data>
249+ </field>
250+ </record>
251+ </data>
252+</openerp>

Subscribers

People subscribed via source and target branches