Merge lp:~dreis-pt/project-service/7.0-project_issue_reassign-dr into lp:~project-core-editors/project-service/trunk

Proposed by Daniel Reis
Status: Needs review
Proposed branch: lp:~dreis-pt/project-service/7.0-project_issue_reassign-dr
Merge into: lp:~project-core-editors/project-service/trunk
Diff against target: 474 lines (+422/-0)
10 files modified
project_issue_reassign/__init__.py (+3/-0)
project_issue_reassign/__openerp__.py (+54/-0)
project_issue_reassign/i18n/project_issue_reassign.pot (+82/-0)
project_issue_reassign/i18n/pt.po (+82/-0)
project_issue_reassign/project.py (+48/-0)
project_issue_reassign/project_issue_data.xml (+24/-0)
project_issue_reassign/project_issue_view.xml (+33/-0)
project_issue_reassign/wizard/__init__.py (+2/-0)
project_issue_reassign/wizard/project_issue_reassign.py (+48/-0)
project_issue_reassign/wizard/project_issue_reassign_view.xml (+46/-0)
To merge this branch: bzr merge lp:~dreis-pt/project-service/7.0-project_issue_reassign-dr
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Needs Fixing
Yannick Vaucher @ Camptocamp code review, no test Needs Fixing
Review via email: mp+195275@code.launchpad.net

Description of the change

Module to improve Issue reassignment to other Projects or Users.

To post a comment you must log in.
Revision history for this message
Daniel Reis (dreis-pt) wrote :

I found possible usability issues, so I'0m setting to "Work in Progress" while I investigate.

Revision history for this message
Daniel Reis (dreis-pt) wrote :

It's ready to be reviewed.
A new feature was added, to generate a notification when the Issue's responsibility changes.

Revision history for this message
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote :

Just some nitpickings:

l.419
self.pool.get('project.issue') can be written self.pool['project.issue']

l.421-422
assign_to.user_id and assign_to.user_id.id or None

can simply be written

assign_to.user_id.id

As assign_to.user_id if not defined will return browse_null and browse_null.id will return None

http://bazaar.launchpad.net/~openerp/openobject-server/7.0/view/head:/openerp/osv/orm.py#L266

Otherwise LGTM

(can't check pt.po)

review: Needs Fixing (code review, no test)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Daniel, thank you very much for your contrib. Some remarks:

- l.400, please put orm.TransientModel instead of osv, for better future compatibility (and change accordingly import).
- Please use CapsWords convention for class names as agreed not long ago.

The rest LGTM.

Regards.

review: Needs Fixing (code review)
Revision history for this message
Daniel Reis (dreis-pt) wrote :

This project is now hosted on https://github.com/OCA/project-service. Please move your proposal there.
This guide may help you https://github.com/OCA/maintainers-tools/wiki/How-to-move-a-Merge-Proposal-to-GitHub

Unmerged revisions

29. By Daniel Reis

Added notifications when assigned user changes.

28. By Daniel Reis

Added module to improve Issue reassignment to other Projects or Users

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'project_issue_reassign'
2=== added file 'project_issue_reassign/__init__.py'
3--- project_issue_reassign/__init__.py 1970-01-01 00:00:00 +0000
4+++ project_issue_reassign/__init__.py 2014-04-02 11:39:40 +0000
5@@ -0,0 +1,3 @@
6+# -*- coding: utf-8 -*-
7+import project
8+import wizard
9
10=== added file 'project_issue_reassign/__openerp__.py'
11--- project_issue_reassign/__openerp__.py 1970-01-01 00:00:00 +0000
12+++ project_issue_reassign/__openerp__.py 2014-04-02 11:39:40 +0000
13@@ -0,0 +1,54 @@
14+# -*- coding: utf-8 -*-
15+##############################################################################
16+#
17+# Copyright (C) 2013 Daniel Reis
18+#
19+# This program is free software: you can redistribute it and/or modify
20+# it under the terms of the GNU Affero General Public License as
21+# published by the Free Software Foundation, either version 3 of the
22+# License, or (at your option) any later version.
23+#
24+# This program is distributed in the hope that it will be useful,
25+# but WITHOUT ANY WARRANTY; without even the implied warranty of
26+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27+# GNU Affero General Public License for more details.
28+#
29+# You should have received a copy of the GNU Affero General Public License
30+# along with this program. If not, see <http://www.gnu.org/licenses/>.
31+#
32+##############################################################################
33+{
34+ 'name': 'Reassign Project Issues',
35+ 'summary': 'Reassign Issues to other Responsibles and Projects',
36+ 'version': '1.1',
37+ "category": "Project Management",
38+ 'description': """\
39+The Responsible (``user_id``) field is made read only, and can instead be
40+changed through a wizard, accessible only to Project Users.
41+
42+Regular users (Employee group) will be able to see who is handling the request,
43+but won't be able to change it.
44+
45+Project Users can click on the "=> Reassign" link, in front of the current
46+responsible, to open a dialog where they can select the new responsible and/or
47+new Project/Service Team it should be assigned to.
48+
49+Mass reassignments can also be made, through the context menu action on the
50+Issues list view.
51+
52+Also adds notifications to followers when issue is reassigned / responsible
53+is changed.
54+""",
55+ 'author': 'Daniel Reis',
56+ 'website': '',
57+ 'depends': [
58+ 'project_issue',
59+ ],
60+ 'data': [
61+ 'project_issue_data.xml',
62+ 'wizard/project_issue_reassign_view.xml',
63+ 'project_issue_view.xml',
64+ ],
65+ 'installable': True,
66+}
67+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
68
69=== added directory 'project_issue_reassign/i18n'
70=== added file 'project_issue_reassign/i18n/project_issue_reassign.pot'
71--- project_issue_reassign/i18n/project_issue_reassign.pot 1970-01-01 00:00:00 +0000
72+++ project_issue_reassign/i18n/project_issue_reassign.pot 2014-04-02 11:39:40 +0000
73@@ -0,0 +1,82 @@
74+# Translation of OpenERP Server.
75+# This file contains the translation of the following modules:
76+# * project_issue_reassign
77+#
78+msgid ""
79+msgstr ""
80+"Project-Id-Version: OpenERP Server 7.0\n"
81+"Report-Msgid-Bugs-To: \n"
82+"POT-Creation-Date: 2014-04-02 10:56+0000\n"
83+"PO-Revision-Date: 2014-04-02 10:56+0000\n"
84+"Last-Translator: <>\n"
85+"Language-Team: \n"
86+"MIME-Version: 1.0\n"
87+"Content-Type: text/plain; charset=UTF-8\n"
88+"Content-Transfer-Encoding: \n"
89+"Plural-Forms: \n"
90+
91+#. module: project_issue_reassign
92+#: view:project.issue.reassign:0
93+msgid "or"
94+msgstr ""
95+
96+#. module: project_issue_reassign
97+#: code:addons/project_issue_reassign/wizard/project_issue_reassign.py:42
98+#, python-format
99+msgid "No active Issues found."
100+msgstr ""
101+
102+#. module: project_issue_reassign
103+#: model:ir.model,name:project_issue_reassign.model_project_issue
104+msgid "Project Issue"
105+msgstr ""
106+
107+#. module: project_issue_reassign
108+#: model:ir.model,name:project_issue_reassign.model_project_issue_reassign
109+msgid "Issue Reassign"
110+msgstr ""
111+
112+#. module: project_issue_reassign
113+#: view:project.issue.reassign:0
114+msgid "_Reassign"
115+msgstr ""
116+
117+#. module: project_issue_reassign
118+#: model:ir.actions.act_window,name:project_issue_reassign.issue_reassign_wizard_action
119+msgid "Reassign Issues"
120+msgstr ""
121+
122+#. module: project_issue_reassign
123+#: model:ir.actions.act_window,name:project_issue_reassign.action_project_issue_reassign
124+#: view:project.issue.reassign:0
125+msgid "Reassign Project Issue"
126+msgstr ""
127+
128+#. module: project_issue_reassign
129+#: code:addons/project_issue_reassign/project.py:30
130+#, python-format
131+msgid "No reassignment data was provided."
132+msgstr ""
133+
134+#. module: project_issue_reassign
135+#: model:mail.message.subtype,description:project_issue_reassign.mt_issue_reassign
136+#: model:mail.message.subtype,description:project_issue_reassign.mt_project_issue_reassign
137+msgid "Issue reassignment"
138+msgstr ""
139+
140+#. module: project_issue_reassign
141+#: view:project.issue:0
142+msgid "⇒ Reassign"
143+msgstr ""
144+
145+#. module: project_issue_reassign
146+#: view:project.issue.reassign:0
147+msgid "Cancel"
148+msgstr ""
149+
150+#. module: project_issue_reassign
151+#: model:mail.message.subtype,name:project_issue_reassign.mt_issue_reassign
152+#: model:mail.message.subtype,name:project_issue_reassign.mt_project_issue_reassign
153+msgid "Issue Reassignment"
154+msgstr ""
155+
156
157=== added file 'project_issue_reassign/i18n/pt.po'
158--- project_issue_reassign/i18n/pt.po 1970-01-01 00:00:00 +0000
159+++ project_issue_reassign/i18n/pt.po 2014-04-02 11:39:40 +0000
160@@ -0,0 +1,82 @@
161+# Translation of OpenERP Server.
162+# This file contains the translation of the following modules:
163+# * project_issue_reassign
164+#
165+msgid ""
166+msgstr ""
167+"Project-Id-Version: OpenERP Server 7.0\n"
168+"Report-Msgid-Bugs-To: \n"
169+"POT-Creation-Date: 2014-04-02 10:56+0000\n"
170+"PO-Revision-Date: 2014-04-02 10:56+0000\n"
171+"Last-Translator: <>\n"
172+"Language-Team: \n"
173+"MIME-Version: 1.0\n"
174+"Content-Type: text/plain; charset=UTF-8\n"
175+"Content-Transfer-Encoding: \n"
176+"Plural-Forms: \n"
177+
178+#. module: project_issue_reassign
179+#: view:project.issue.reassign:0
180+msgid "or"
181+msgstr "ou"
182+
183+#. module: project_issue_reassign
184+#: code:addons/project_issue_reassign/wizard/project_issue_reassign.py:42
185+#, python-format
186+msgid "No active Issues found."
187+msgstr "Não foram encontrados Incidentes ativos."
188+
189+#. module: project_issue_reassign
190+#: model:ir.model,name:project_issue_reassign.model_project_issue
191+msgid "Project Issue"
192+msgstr "Incidente"
193+
194+#. module: project_issue_reassign
195+#: model:ir.model,name:project_issue_reassign.model_project_issue_reassign
196+msgid "Issue Reassign"
197+msgstr "Reatribuir Incidente
198+
199+#. module: project_issue_reassign
200+#: view:project.issue.reassign:0
201+msgid "_Reassign"
202+msgstr "_Reatribuir"
203+
204+#. module: project_issue_reassign
205+#: model:ir.actions.act_window,name:project_issue_reassign.issue_reassign_wizard_action
206+msgid "Reassign Issues"
207+msgstr "Reatribuir Incidentes"
208+
209+#. module: project_issue_reassign
210+#: model:ir.actions.act_window,name:project_issue_reassign.action_project_issue_reassign
211+#: view:project.issue.reassign:0
212+msgid "Reassign Project Issue"
213+msgstr "Reatribuir Incidentes"
214+
215+#. module: project_issue_reassign
216+#: code:addons/project_issue_reassign/project.py:30
217+#, python-format
218+msgid "No reassignment data was provided."
219+msgstr "Faltam dados para a reatribuição."
220+
221+#. module: project_issue_reassign
222+#: model:mail.message.subtype,description:project_issue_reassign.mt_issue_reassign
223+#: model:mail.message.subtype,description:project_issue_reassign.mt_project_issue_reassign
224+msgid "Issue reassignment"
225+msgstr "Reatribuição do incidente"
226+
227+#. module: project_issue_reassign
228+#: view:project.issue:0
229+msgid "⇒ Reassign"
230+msgstr "⇒ Reatribuir"
231+
232+#. module: project_issue_reassign
233+#: view:project.issue.reassign:0
234+msgid "Cancel"
235+msgstr "Cancelar"
236+
237+#. module: project_issue_reassign
238+#: model:mail.message.subtype,name:project_issue_reassign.mt_issue_reassign
239+#: model:mail.message.subtype,name:project_issue_reassign.mt_project_issue_reassign
240+msgid "Issue Reassignment"
241+msgstr "Reatribuição Incidente"
242+
243
244=== added file 'project_issue_reassign/project.py'
245--- project_issue_reassign/project.py 1970-01-01 00:00:00 +0000
246+++ project_issue_reassign/project.py 2014-04-02 11:39:40 +0000
247@@ -0,0 +1,48 @@
248+# -*- coding: utf-8 -*-
249+##############################################################################
250+#
251+# Copyright (C) 2013 Daniel Reis
252+#
253+# This program is free software: you can redistribute it and/or modify
254+# it under the terms of the GNU Affero General Public License as
255+# published by the Free Software Foundation, either version 3 of the
256+# License, or (at your option) any later version.
257+#
258+# This program is distributed in the hope that it will be useful,
259+# but WITHOUT ANY WARRANTY; without even the implied warranty of
260+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
261+# GNU Affero General Public License for more details.
262+#
263+# You should have received a copy of the GNU Affero General Public License
264+# along with this program. If not, see <http://www.gnu.org/licenses/>.
265+#
266+##############################################################################
267+
268+from openerp.osv import orm
269+from openerp.tools.translate import _
270+
271+
272+class ProjectIssue(orm.Model):
273+ _inherit = 'project.issue'
274+
275+ def do_reassign(self, cr, uid, ids, user=None, proj=None, context=None):
276+ """ Reassign an Issue to another User and/or Project """
277+ assert user or proj, _("No reassignment data was provided.")
278+ # Add tracking notifications to model
279+ if 'user_id' not in self._track:
280+ self._track['user_id'] = {
281+ 'project_issue_reassign.mt_issue_reassign':
282+ lambda self, cr, uid, obj, ctx: True,
283+ }
284+ if 'project_id' not in self._track:
285+ self._track['project_id'] = {
286+ 'project_issue_reassign.mt_issue_reassign':
287+ lambda self, cr, uid, obj, ctx: True,
288+ }
289+ # write reassignment changes
290+ reassign_data = {}
291+ if user:
292+ reassign_data['user_id'] = user
293+ if proj:
294+ reassign_data['project_id'] = proj
295+ return self.write(cr, uid, ids, reassign_data, context=context)
296
297=== added file 'project_issue_reassign/project_issue_data.xml'
298--- project_issue_reassign/project_issue_data.xml 1970-01-01 00:00:00 +0000
299+++ project_issue_reassign/project_issue_data.xml 2014-04-02 11:39:40 +0000
300@@ -0,0 +1,24 @@
301+<?xml version="1.0"?>
302+<openerp>
303+ <data noupdate="1">
304+
305+ <!-- Issue-related subtypes for messaging / Chatter
306+ Active by default, to ensure assignments to people
307+ outside the Project followers are notified -->
308+ <record id="mt_issue_reassign" model="mail.message.subtype">
309+ <field name="name">Issue Reassignment</field>
310+ <field name="res_model">project.issue</field>
311+ <field name="default" eval="True"/>
312+ <field name="description">Issue reassignment</field>
313+ </record>
314+ <!-- Project-related subtypes for messaging / Chatter -->
315+ <record id="mt_project_issue_reassign" model="mail.message.subtype">
316+ <field name="name">Issue Reassigned</field>
317+ <field name="res_model">project.project</field>
318+ <field name="description">Issue reassigned</field>
319+ <field name="parent_id" eval="ref('mt_issue_reassign')"/>
320+ <field name="relation_field">project_id</field>
321+ </record>
322+
323+ </data>
324+</openerp>
325
326=== added file 'project_issue_reassign/project_issue_view.xml'
327--- project_issue_reassign/project_issue_view.xml 1970-01-01 00:00:00 +0000
328+++ project_issue_reassign/project_issue_view.xml 2014-04-02 11:39:40 +0000
329@@ -0,0 +1,33 @@
330+<?xml version="1.0" encoding="utf-8"?>
331+<openerp>
332+ <data>
333+
334+
335+ <!-- Project Issue form -->
336+ <record id="project_issue_form_view_reassign" model="ir.ui.view">
337+ <field name="name">project_issue_form_view_reassign</field>
338+ <field name="model">project.issue</field>
339+ <field name="inherit_id" ref="project_issue.project_issue_form_view"/>
340+ <field name="arch" type="xml">
341+
342+ <!-- Important: users than can access only followed issues must
343+ be left as "Responsible" upon creation, to make sure they are
344+ added to the followers. Otherwise they might get an
345+ access denied error -->
346+ <field name="user_id" position="replace">
347+ <label for="user_id" groups="base.group_user"/>
348+ <span>
349+ <field name="user_id" class="oe_inline" readonly="1"
350+ groups="base.group_user"/>
351+ <button name="%(action_project_issue_reassign)d"
352+ string="⇒ Reassign" type="action" class="oe_link"
353+ groups="project.group_project_user" states="draft,open,pending"/>
354+ </span>
355+ </field>
356+
357+ </field>
358+ </record>
359+
360+
361+ </data>
362+</openerp>
363
364=== added directory 'project_issue_reassign/wizard'
365=== added file 'project_issue_reassign/wizard/__init__.py'
366--- project_issue_reassign/wizard/__init__.py 1970-01-01 00:00:00 +0000
367+++ project_issue_reassign/wizard/__init__.py 2014-04-02 11:39:40 +0000
368@@ -0,0 +1,2 @@
369+# -*- coding: utf-8 -*-
370+import project_issue_reassign
371
372=== added file 'project_issue_reassign/wizard/project_issue_reassign.py'
373--- project_issue_reassign/wizard/project_issue_reassign.py 1970-01-01 00:00:00 +0000
374+++ project_issue_reassign/wizard/project_issue_reassign.py 2014-04-02 11:39:40 +0000
375@@ -0,0 +1,48 @@
376+# -*- coding: utf-8 -*-
377+##############################################################################
378+#
379+# Copyright (C) 2013 Daniel Reis
380+#
381+# This program is free software: you can redistribute it and/or modify
382+# it under the terms of the GNU Affero General Public License as
383+# published by the Free Software Foundation, either version 3 of the
384+# License, or (at your option) any later version.
385+#
386+# This program is distributed in the hope that it will be useful,
387+# but WITHOUT ANY WARRANTY; without even the implied warranty of
388+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
389+# GNU Affero General Public License for more details.
390+#
391+# You should have received a copy of the GNU Affero General Public License
392+# along with this program. If not, see <http://www.gnu.org/licenses/>.
393+#
394+##############################################################################
395+
396+from openerp.osv import fields, osv
397+from openerp.tools.translate import _
398+
399+
400+class project_issue_reassign(osv.TransientModel):
401+ _name = 'project.issue.reassign'
402+ _description = 'Issue Reassign'
403+
404+ _columns = {
405+ 'project_id': fields.many2one(
406+ 'project.project', 'Project',
407+ help="Project this issue should belong to"),
408+ 'user_id': fields.many2one(
409+ 'res.users', 'Assign To',
410+ help="User you want to assign this issue to"),
411+ }
412+
413+ def reassign(self, cr, uid, ids, context=None):
414+ if context is None:
415+ context = {}
416+ issue_ids = context.get('active_ids') or [context.get('active_id')]
417+ assert issue_ids, _("No active Issues found.")
418+ assign_to = self.browse(cr, uid, ids, context=context)[0]
419+ return self.pool.get('project.issue').do_reassign(
420+ cr, uid, issue_ids,
421+ assign_to.user_id and assign_to.user_id.id or None,
422+ assign_to.project_id and assign_to.project_id.id or None,
423+ context=context)
424
425=== added file 'project_issue_reassign/wizard/project_issue_reassign_view.xml'
426--- project_issue_reassign/wizard/project_issue_reassign_view.xml 1970-01-01 00:00:00 +0000
427+++ project_issue_reassign/wizard/project_issue_reassign_view.xml 2014-04-02 11:39:40 +0000
428@@ -0,0 +1,46 @@
429+<?xml version="1.0" encoding="utf-8"?>
430+<openerp>
431+ <data>
432+
433+ <record id="view_project_issue_reassign" model="ir.ui.view">
434+ <field name="name">Reassign Project Issue</field>
435+ <field name="model">project.issue.reassign</field>
436+ <field name="arch" type="xml">
437+
438+ <form string="Reassign Project Issue" version="7.0">
439+ <group>
440+ <field name="user_id"/>
441+ <field name="project_id"/>
442+ </group>
443+ <footer>
444+ <button name="reassign" string="_Reassign" type="object" class="oe_highlight"/>
445+ or
446+ <button string="Cancel" class="oe_link" special="cancel"/>
447+ </footer>
448+ </form>
449+
450+ </field>
451+ </record>
452+
453+ <!-- action to call from Issue form button -->
454+ <record id="action_project_issue_reassign" model="ir.actions.act_window">
455+ <field name="name">Reassign Project Issue</field>
456+ <field name="type">ir.actions.act_window</field>
457+ <field name="res_model">project.issue.reassign</field>
458+ <field name="view_type">form</field>
459+ <field name="view_mode">form</field>
460+ <field name="view_id" ref="view_project_issue_reassign"/>
461+ <field name="target">new</field>
462+ </record>
463+
464+ <!-- wizard action on Issue context menu -->
465+ <act_window id="issue_reassign_wizard_action"
466+ name="Reassign Issues"
467+ src_model="project.issue"
468+ res_model="project.issue.reassign"
469+ view_type="form" view_mode="form"
470+ key2="client_action_multi" target="new"
471+ groups="project.group_project_user"/>
472+
473+ </data>
474+</openerp>

Subscribers

People subscribed via source and target branches