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

Proposed by Daniel Reis
Status: Merged
Merged at revision: 38
Proposed branch: lp:~dreis-pt/project-service/7.0-issue_task-dr
Merge into: lp:~project-core-editors/project-service/trunk
Diff against target: 1627 lines (+467/-922)
21 files modified
project_issue_service/board_project_view.xml (+0/-12)
project_issue_service/project_issue_workflow.xml (+0/-108)
project_issue_service/wizard/__init__.py (+0/-1)
project_issue_service/wizard/project_task_reevaluate.py (+0/-38)
project_issue_task/__init__.py (+3/-4)
project_issue_task/__openerp__.py (+20/-27)
project_issue_task/i18n/fr.po (+97/-0)
project_issue_task/i18n/project_issue_task.pot (+97/-0)
project_issue_task/i18n/pt.po (+97/-0)
project_issue_task/project_issue.py (+40/-142)
project_issue_task/project_issue_view.xml (+9/-163)
project_issue_task/project_task.py (+34/-71)
project_issue_task/project_task_cause.py (+6/-10)
project_issue_task/project_task_cause_view.xml (+19/-10)
project_issue_task/project_task_view.xml (+14/-39)
project_issue_task/security/ir.model.access.csv (+1/-1)
project_issue_task/security/project_security.xml (+30/-0)
project_task_service/__init__.py (+0/-4)
project_task_service/__openerp__.py (+0/-52)
project_task_service/project_task.py (+0/-88)
project_task_service/project_task_view.xml (+0/-152)
To merge this branch: bzr merge lp:~dreis-pt/project-service/7.0-issue_task-dr
Reviewer Review Type Date Requested Status
Guewen Baconnier @ Camptocamp code review Approve
Joël Grand-Guillaume @ camptocamp code review, no tests Approve
Yannick Vaucher @ Camptocamp code review, no tests Approve
Review via email: mp+195985@code.launchpad.net

Description of the change

Module to "Use Tasks to support Issue resolution reports".
Simplifies and replaces the former v6 "project_issue_service" and "project_task_service".

To post a comment you must log in.
30. By Daniel Reis

Add french translation, credits to invitu

31. By Daniel Reis

Fixed to make the related issue a stored function field

Revision history for this message
invitu (invitu) wrote :

Dear Daniel

We think that task priority should be synchronized with issue priority

In the other way, changes in task stage should synchronize with issue stage

Please check out our MP

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

Hi,

Thanks for the contribs ! I saw few little stuff here :

 * Use from . import XYZ
 * Use 'data' and 'demo' in __openerp__.py, update_xml, init_xml, etc.. are deprecated
 * Line 1018 : you miss a context propagation

Otherwise all good.

Regards,

Joël

review: Needs Fixing (code review, no tests)
32. By Daniel Reis

Fixes from code review

33. By Daniel Reis

Fix trailing empty line

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

Hello Daniel,

ll.737-738 dict comprehension is not python 2.6 compatible please use dict constructor instead.

Thanks

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

Should I be required to support Python < 2.7 ?

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

As openerp is 2.6 compatible inserting 2.7 code would break the compatibility.

https://doc.openerp.com/v7.0/install/linux/server/
"Python 2.6 or later is required for OpenERP 6.1."

No further update for 7.0 was made so we should stick to 2.6 compatibility as in 6.1.

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

Yannick, that doc page states that "Python 2.6 or later is required for OpenERP 6.1".
Well, 6.1 is not officially supported by now, and I believe that neither Python 2.6.
I would like some more opinions on this. Do you think we should start a thread on the ML?

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

This can only be a good idea to launch a talk on ML. At least it can sync everyone on that subject.

34. By Daniel Reis

Changed dict comprehension into dict constructor, for python 2.6 compatibility

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

Yannick, I made the fix you suggested.

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

Thanks for the fix and having launched the talk that was quite uncertain for everyone.

LGTM

review: Approve (code review, no tests)
Revision history for this message
Daniel Reis (dreis-pt) wrote :

OK, just need Joël's review now.

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

@Joel: I believe issues from your review have been addressed in rev 32.
Thanks!

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

This is the oldest MP on this project, and I believe that all issues have been fixed.
Unless opinions otherwise, I will go on with it's merge.

Revision history for this message
Joël Grand-Guillaume @ camptocamp (jgrandguillaume-c2c) wrote :

LGTM, Sorry for late reply, was on holidays

review: Approve (code review, no tests)
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hi Daniel,

I tried to merge your branch and unfortunately got a conflict.
Can you rebase from the head?

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'project_issue_service/board_project_view.xml'
2--- project_issue_service/board_project_view.xml 2012-11-22 13:29:38 +0000
3+++ project_issue_service/board_project_view.xml 1970-01-01 00:00:00 +0000
4@@ -1,12 +0,0 @@
5-<?xml version="1.0" encoding="utf-8"?>
6-<openerp>
7- <data>
8-
9- <record id="project.action_project_vs_remaining_hours_graph" model="ir.actions.act_window">
10- <!-- Exclude admin's projects from graph -->
11- <field name="domain">[('user_id','!=',1),('user_id','=',uid),('state','=','open')]</field>
12- </record>
13-
14- </data>
15-</openerp>
16-
17\ No newline at end of file
18
19=== removed file 'project_issue_service/project_issue_workflow.xml'
20--- project_issue_service/project_issue_workflow.xml 2012-11-22 13:29:38 +0000
21+++ project_issue_service/project_issue_workflow.xml 1970-01-01 00:00:00 +0000
22@@ -1,108 +0,0 @@
23-<?xml version="1.0"?>
24-<openerp>
25- <data>
26- <record model="workflow" id="wkf_project_issue">
27- <field name="name">Project Issue Workflow</field>
28- <field name="osv">project.issue</field>
29- <field name="on_create">True</field>
30- </record>
31-
32- <record model="workflow.activity" id="act_draft">
33- <field name="wkf_id" ref="wkf_project_issue"/>
34- <field name="flow_start">True</field>
35- <field name="name">draft</field>
36- <field name="kind">function</field>
37- <field name="action">write({'state': 'draft'})
38-do_routing()</field>
39- </record>
40-
41- <record model="workflow.activity" id="act_open">
42- <field name="wkf_id" ref="wkf_project_issue"/>
43- <field name="name">open</field>
44- <field name="kind">function</field>
45- <field name="action">write({'state': 'open'})
46-do_routing()</field>
47- </record>
48-
49- <record model="workflow.activity" id="act_pending">
50- <field name="wkf_id" ref="wkf_project_issue"/>
51- <field name="name">pending</field>
52- <field name="kind">function</field>
53- <field name="action">write({'state': 'pending'})</field>
54- </record>
55-
56- <record model="workflow.activity" id="act_done">
57- <field name="wkf_id" ref="wkf_project_issue"/>
58- <field name="name">done</field>
59- <field name="kind">function</field>
60- <field name="action">write({'state': 'done'})</field>
61- <field name="flow_stop">True</field>
62- </record>
63-
64- <record model="workflow.activity" id="act_cancel">
65- <field name="wkf_id" ref="wkf_project_issue"/>
66- <field name="name">cancel</field>
67- <field name="kind">function</field>
68- <field name="action">write({'state': 'cancel'})</field>
69- <field name="flow_stop">True</field>
70- </record>
71-
72-
73-<!-- == TRANSITIONS == -->
74- <!-- DRAFT -->
75- <record model="workflow.transition" id="t_draft2cancel">
76- <field name="act_from" ref="act_draft"/>
77- <field name="act_to" ref="act_cancel"/>
78- <field name="signal">case_cancel</field>
79- </record>
80- <record model="workflow.transition" id="t_draft2open">
81- <field name="act_from" ref="act_draft"/>
82- <field name="act_to" ref="act_open"/>
83- <field name="signal">case_open</field>
84- </record>
85-
86- <!-- OPEN -->
87- <record model="workflow.transition" id="t_open2done">
88- <field name="act_from" ref="act_open"/>
89- <field name="act_to" ref="act_done"/>
90- <field name="signal">case_close</field>
91- </record>
92- <record model="workflow.transition" id="t_open2pending">
93- <field name="act_from" ref="act_open"/>
94- <field name="act_to" ref="act_pending"/>
95- <field name="signal">case_pending</field>
96- </record>
97- <record model="workflow.transition" id="t_open2cancel">
98- <field name="act_from" ref="act_open"/>
99- <field name="act_to" ref="act_cancel"/>
100- <field name="signal">case_cancel</field>
101- </record>
102-
103- <!-- PENDING -->
104- <record model="workflow.transition" id="t_pending2open">
105- <field name="act_from" ref="act_pending"/>
106- <field name="act_to" ref="act_open"/>
107- <field name="signal">case_open</field>
108- </record>
109-
110- <!-- not valid
111- <record model="workflow.transition" id="t_done2draft">
112- <field name="act_from" ref="act_done"/>
113- <field name="act_to" ref="act_draft"/>
114- <field name="signal">case_reset</field>
115- </record>
116- <record model="workflow.transition" id="t_cancel2draft">
117- <field name="act_from" ref="act_cancel"/>
118- <field name="act_to" ref="act_draft"/>
119- <field name="signal">case_reset</field>
120- </record>
121- -->
122-
123- </data>
124-</openerp>
125-
126-
127-
128-
129-
130-
131
132=== removed directory 'project_issue_service/static'
133=== removed directory 'project_issue_service/static/src'
134=== removed directory 'project_issue_service/static/src/img'
135=== removed file 'project_issue_service/static/src/img/icon.png'
136Binary files project_issue_service/static/src/img/icon.png 2012-11-22 13:29:38 +0000 and project_issue_service/static/src/img/icon.png 1970-01-01 00:00:00 +0000 differ
137=== removed directory 'project_issue_service/wizard'
138=== removed file 'project_issue_service/wizard/__init__.py'
139--- project_issue_service/wizard/__init__.py 2012-11-22 13:29:38 +0000
140+++ project_issue_service/wizard/__init__.py 1970-01-01 00:00:00 +0000
141@@ -1,1 +0,0 @@
142-import project_task_reevaluate
143
144=== removed file 'project_issue_service/wizard/project_task_reevaluate.py'
145--- project_issue_service/wizard/project_task_reevaluate.py 2012-11-22 13:29:38 +0000
146+++ project_issue_service/wizard/project_task_reevaluate.py 1970-01-01 00:00:00 +0000
147@@ -1,38 +0,0 @@
148-# -*- coding: utf-8 -*-
149-##############################################################################
150-#
151-# Copyright (C) 2012 Daniel Reis
152-#
153-# This program is free software: you can redistribute it and/or modify
154-# it under the terms of the GNU Affero General Public License as
155-# published by the Free Software Foundation, either version 3 of the
156-# License, or (at your option) any later version.
157-#
158-# This program is distributed in the hope that it will be useful,
159-# but WITHOUT ANY WARRANTY; without even the implied warranty of
160-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
161-# GNU Affero General Public License for more details.
162-#
163-# You should have received a copy of the GNU Affero General Public License
164-# along with this program. If not, see <http://www.gnu.org/licenses/>.
165-#
166-##############################################################################
167-from osv import fields, osv
168-from tools.translate import _
169-
170-class project_task_reevaluate(osv.osv_memory):
171- _inherit = 'project.task.reevaluate'
172-
173- def compute_hours(self, cr, uid, ids, context=None):
174- """
175- Reevaluate relinks the Issue's current Task
176- """
177- task_pool = self.pool.get('project.task')
178- issue_pool = self.pool.get('project.issue')
179- for o in task_pool.browse(cr, uid, context.get('active_ids', list()), context=context):
180- if o.issue_id and not o.issue_id.task_id:
181- issue_pool.write(cr, uid, [o.issue_id.id], {'task_id': o.id}, context=context)
182- return super(project_task_reevaluate, self).compute_hours(cr, uid, ids, context)
183-project_task_reevaluate()
184-
185-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
186
187=== renamed directory 'project_issue_service' => 'project_issue_task'
188=== modified file 'project_issue_task/__init__.py' (properties changed: +x to -x)
189--- project_issue_service/__init__.py 2012-11-22 13:29:38 +0000
190+++ project_issue_task/__init__.py 2014-02-25 12:39:41 +0000
191@@ -1,5 +1,4 @@
192 # -*- coding: utf-8 -*-
193-import project_issue
194-import project_task
195-import wizard
196-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
197+from . import project_issue
198+from . import project_task_cause
199+from . import project_task
200
201=== modified file 'project_issue_task/__openerp__.py' (properties changed: +x to -x)
202--- project_issue_service/__openerp__.py 2013-05-09 13:35:42 +0000
203+++ project_issue_task/__openerp__.py 2014-02-25 12:39:41 +0000
204@@ -1,7 +1,7 @@
205 # -*- coding: utf-8 -*-
206 ##############################################################################
207 #
208-# Copyright (C) 2012 Daniel Reis
209+# Copyright (C) 2012 - 2013 Daniel Reis
210 #
211 # This program is free software: you can redistribute it and/or modify
212 # it under the terms of the GNU Affero General Public License as
213@@ -19,41 +19,34 @@
214 ##############################################################################
215
216 {
217- 'name': 'Project Issue and Task integration',
218+ 'name': 'Project Issue related Tasks',
219+ 'summary': 'Use Tasks to support Issue resolution reports',
220 'version': '1.1',
221 'category': 'Project Management',
222 'description': """\
223-Integrate Issues and Tasks in a common workflow, as is common in service management scenarios.
224-
225-1. End user creates new Issue
226-2. Service Desk User reviews the new Issue:
227- If a technical person intervention is needed, creates a Task for it.
228- If not, it's closed without the need for an intervention Task.
229-3. Service Team User schedules the new Task
230-4. Service Team User completes the Task. The issue is automatically closed.
231-
232-CHANGE LOG
233-============
234-1.1 Reference sequence (`ref` field) moved to module `project_issue_sequences`.
235-
236+Support for the use case where solving an Issue means a Task should be done,
237+such as an on site visit, and a report must be made to document the work done.
238+This is a common scenario in technical field services.
239+
240+The Issue form already has a "Task" field, allowing to create a Task related
241+to an Issue.
242+This module adds some usability improvements:
243+
244+ * "Create Task" button on the Issue form
245+ * Automaticaly Close the Issue when the Task is Closed
246+ * Automatically Cancel the Task when Issue is Cancelled
247+ * Make the Task also visible to all followers of the related Issue
248 """,
249 'author': 'Daniel Reis',
250- 'website': 'daniel.reis@securitas.pt',
251 'depends': [
252- 'project', 'project_functional_blocks',
253 'project_issue',
254- 'project_issue_department',
255- 'project_issue_sequences',
256- 'crm_categ_hierarchy',
257- 'crm',
258 ],
259- 'update_xml': [
260+ 'data': [
261 'project_issue_view.xml',
262+ 'project_task_cause_view.xml',
263 'project_task_view.xml',
264- 'board_project_view.xml',
265- #'project_issue_workflow.xml', #<= not using it, to avoid migrating former Issues to the new workflow
266+ 'security/ir.model.access.csv',
267+ 'security/project_security.xml',
268 ],
269- 'installable': False,
270- 'application': True,
271+ 'installable': True,
272 }
273-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
274
275=== added directory 'project_issue_task/i18n'
276=== added file 'project_issue_task/i18n/fr.po'
277--- project_issue_task/i18n/fr.po 1970-01-01 00:00:00 +0000
278+++ project_issue_task/i18n/fr.po 2014-02-25 12:39:41 +0000
279@@ -0,0 +1,97 @@
280+# Translation of OpenERP Server.
281+# This file contains the translation of the following modules:
282+# * project_issue_task
283+#
284+msgid ""
285+msgstr ""
286+"Project-Id-Version: OpenERP Server 7.0\n"
287+"Report-Msgid-Bugs-To: \n"
288+"POT-Creation-Date: 2013-11-21 21:31+0000\n"
289+"PO-Revision-Date: 2013-11-21 21:31+0000\n"
290+"Last-Translator: <>\n"
291+"Language-Team: \n"
292+"MIME-Version: 1.0\n"
293+"Content-Type: text/plain; charset=UTF-8\n"
294+"Content-Transfer-Encoding: \n"
295+"Plural-Forms: \n"
296+
297+#. module: project_issue_task
298+#: code:addons/project_issue_task/project_issue.py:38
299+#, python-format
300+msgid "Report for %s"
301+msgstr "Rapport pour %s"
302+
303+#. module: project_issue_task
304+#: view:project.issue:0
305+msgid "Task Report"
306+msgstr "Rapport de tâche"
307+
308+#. module: project_issue_task
309+#: field:project.task.cause,code:0
310+msgid "Code"
311+msgstr "Code"
312+
313+#. module: project_issue_task
314+#: field:project.task.cause,description:0
315+msgid "Description"
316+msgstr "Description"
317+
318+#. module: project_issue_task
319+#: field:project.task,ref:0
320+msgid "Reference"
321+msgstr "Référence"
322+
323+#. module: project_issue_task
324+#: model:ir.model,name:project_issue_task.model_project_issue
325+msgid "Project Issue"
326+msgstr "Incident"
327+
328+#. module: project_issue_task
329+#: field:project.task.cause,sequence:0
330+msgid "Sequence"
331+msgstr "Sequence"
332+
333+#. module: project_issue_task
334+#: field:project.task,reason_id:0
335+msgid "Problem Cause"
336+msgstr "Cause du problème"
337+
338+#. module: project_issue_task
339+#: field:project.task,issue_id:0
340+msgid "Related Issue"
341+msgstr "Incident lié"
342+
343+#. module: project_issue_task
344+#: model:ir.model,name:project_issue_task.model_project_task
345+msgid "Task"
346+msgstr "Tâche"
347+
348+#. module: project_issue_task
349+#: code:addons/project_issue_task/project_issue.py:33
350+#, python-format
351+msgid "A Task is already assigned to the Issue!"
352+msgstr "Une tâche est déjà liée à l'incident!"
353+
354+#. module: project_issue_task
355+#: model:ir.model,name:project_issue_task.model_project_task_cause
356+msgid "Issue Cause"
357+msgstr "Cause de l'incident"
358+
359+#. module: project_issue_task
360+#: field:project.task.cause,name:0
361+msgid "Cause"
362+msgstr "Cause"
363+
364+#. module: project_issue_task
365+#: model:ir.actions.act_window,name:project_issue_task.open_task_cause_form
366+#: model:ir.ui.menu,name:project_issue_task.menu_task_cause_view
367+#: view:project.task.cause:0
368+msgid "Task Issue Causes"
369+msgstr "Causes des incidents"
370+
371+#. module: project_issue_task
372+#: code:addons/project_issue_task/project_issue.py:46
373+#, python-format
374+msgid "Issue Task Report"
375+msgstr "Rapport des tâches de l'incident"
376+
377
378=== added file 'project_issue_task/i18n/project_issue_task.pot'
379--- project_issue_task/i18n/project_issue_task.pot 1970-01-01 00:00:00 +0000
380+++ project_issue_task/i18n/project_issue_task.pot 2014-02-25 12:39:41 +0000
381@@ -0,0 +1,97 @@
382+# Translation of OpenERP Server.
383+# This file contains the translation of the following modules:
384+# * project_issue_task
385+#
386+msgid ""
387+msgstr ""
388+"Project-Id-Version: OpenERP Server 7.0\n"
389+"Report-Msgid-Bugs-To: \n"
390+"POT-Creation-Date: 2013-11-20 15:02+0000\n"
391+"PO-Revision-Date: 2013-11-20 15:02+0000\n"
392+"Last-Translator: <>\n"
393+"Language-Team: \n"
394+"MIME-Version: 1.0\n"
395+"Content-Type: text/plain; charset=UTF-8\n"
396+"Content-Transfer-Encoding: \n"
397+"Plural-Forms: \n"
398+
399+#. module: project_issue_task
400+#: code:addons/project_issue_task/project_issue.py:38
401+#, python-format
402+msgid "Report for %s"
403+msgstr ""
404+
405+#. module: project_issue_task
406+#: view:project.issue:0
407+msgid "Task Report"
408+msgstr ""
409+
410+#. module: project_issue_task
411+#: field:project.task.cause,code:0
412+msgid "Code"
413+msgstr ""
414+
415+#. module: project_issue_task
416+#: field:project.task.cause,description:0
417+msgid "Description"
418+msgstr ""
419+
420+#. module: project_issue_task
421+#: field:project.task,ref:0
422+msgid "Reference"
423+msgstr ""
424+
425+#. module: project_issue_task
426+#: model:ir.model,name:project_issue_task.model_project_issue
427+msgid "Project Issue"
428+msgstr ""
429+
430+#. module: project_issue_task
431+#: field:project.task.cause,sequence:0
432+msgid "Sequence"
433+msgstr ""
434+
435+#. module: project_issue_task
436+#: field:project.task,reason_id:0
437+msgid "Problem Cause"
438+msgstr ""
439+
440+#. module: project_issue_task
441+#: field:project.task,issue_id:0
442+msgid "Related Issue"
443+msgstr ""
444+
445+#. module: project_issue_task
446+#: model:ir.model,name:project_issue_task.model_project_task
447+msgid "Task"
448+msgstr ""
449+
450+#. module: project_issue_task
451+#: code:addons/project_issue_task/project_issue.py:33
452+#, python-format
453+msgid "A Task is already assigned to the Issue!"
454+msgstr ""
455+
456+#. module: project_issue_task
457+#: model:ir.model,name:project_issue_task.model_project_task_cause
458+msgid "Issue Cause"
459+msgstr ""
460+
461+#. module: project_issue_task
462+#: field:project.task.cause,name:0
463+msgid "Cause"
464+msgstr ""
465+
466+#. module: project_issue_task
467+#: model:ir.actions.act_window,name:project_issue_task.open_task_cause_form
468+#: model:ir.ui.menu,name:project_issue_task.menu_task_cause_view
469+#: view:project.task.cause:0
470+msgid "Task Issue Causes"
471+msgstr ""
472+
473+#. module: project_issue_task
474+#: code:addons/project_issue_task/project_issue.py:46
475+#, python-format
476+msgid "Issue Task Report"
477+msgstr ""
478+
479
480=== added file 'project_issue_task/i18n/pt.po'
481--- project_issue_task/i18n/pt.po 1970-01-01 00:00:00 +0000
482+++ project_issue_task/i18n/pt.po 2014-02-25 12:39:41 +0000
483@@ -0,0 +1,97 @@
484+# Translation of OpenERP Server.
485+# This file contains the translation of the following modules:
486+# * project_issue_task
487+#
488+msgid ""
489+msgstr ""
490+"Project-Id-Version: OpenERP Server 7.0\n"
491+"Report-Msgid-Bugs-To: \n"
492+"POT-Creation-Date: 2013-11-20 15:02+0000\n"
493+"PO-Revision-Date: 2013-11-20 15:02+0000\n"
494+"Last-Translator: <>\n"
495+"Language-Team: \n"
496+"MIME-Version: 1.0\n"
497+"Content-Type: text/plain; charset=UTF-8\n"
498+"Content-Transfer-Encoding: \n"
499+"Plural-Forms: \n"
500+
501+#. module: project_issue_task
502+#: code:addons/project_issue_task/project_issue.py:38
503+#, python-format
504+msgid "Report for %s"
505+msgstr "Relatório de %s"
506+
507+#. module: project_issue_task
508+#: view:project.issue:0
509+msgid "Task Report"
510+msgstr "Relatório de Intervenção"
511+
512+#. module: project_issue_task
513+#: field:project.task.cause,code:0
514+msgid "Code"
515+msgstr "Código"
516+
517+#. module: project_issue_task
518+#: field:project.task.cause,description:0
519+msgid "Description"
520+msgstr "Descrição"
521+
522+#. module: project_issue_task
523+#: field:project.task,ref:0
524+msgid "Reference"
525+msgstr "Referência"
526+
527+#. module: project_issue_task
528+#: model:ir.model,name:project_issue_task.model_project_issue
529+msgid "Project Issue"
530+msgstr "Incidente"
531+
532+#. module: project_issue_task
533+#: field:project.task.cause,sequence:0
534+msgid "Sequence"
535+msgstr "Sequência"
536+
537+#. module: project_issue_task
538+#: field:project.task,reason_id:0
539+msgid "Problem Cause"
540+msgstr "Causa do problema"
541+
542+#. module: project_issue_task
543+#: field:project.task,issue_id:0
544+msgid "Related Issue"
545+msgstr "Relativo ao Incidente"
546+
547+#. module: project_issue_task
548+#: model:ir.model,name:project_issue_task.model_project_task
549+msgid "Task"
550+msgstr "Tarefa"
551+
552+#. module: project_issue_task
553+#: code:addons/project_issue_task/project_issue.py:33
554+#, python-format
555+msgid "A Task is already assigned to the Issue!"
556+msgstr "O Incidente já tem uma Tarefa associada!"
557+
558+#. module: project_issue_task
559+#: model:ir.model,name:project_issue_task.model_project_task_cause
560+msgid "Issue Cause"
561+msgstr "Causa do Incidente"
562+
563+#. module: project_issue_task
564+#: field:project.task.cause,name:0
565+msgid "Cause"
566+msgstr "Causa"
567+
568+#. module: project_issue_task
569+#: model:ir.actions.act_window,name:project_issue_task.open_task_cause_form
570+#: model:ir.ui.menu,name:project_issue_task.menu_task_cause_view
571+#: view:project.task.cause:0
572+msgid "Task Issue Causes"
573+msgstr "Causas para Tarefas"
574+
575+#. module: project_issue_task
576+#: code:addons/project_issue_task/project_issue.py:46
577+#, python-format
578+msgid "Issue Task Report"
579+msgstr "Relatório de Intervenção"
580+
581
582=== modified file 'project_issue_task/project_issue.py' (properties changed: +x to -x)
583--- project_issue_service/project_issue.py 2013-01-03 11:34:54 +0000
584+++ project_issue_task/project_issue.py 2014-02-25 12:39:41 +0000
585@@ -1,7 +1,7 @@
586 # -*- coding: utf-8 -*-
587 ##############################################################################
588-#
589-# Copyright (C) 2012 Daniel Reis
590+#
591+# Copyright (C) 2012 - 2013 Daniel Reis
592 #
593 # This program is free software: you can redistribute it and/or modify
594 # it under the terms of the GNU Affero General Public License as
595@@ -18,147 +18,45 @@
596 #
597 ##############################################################################
598
599-from osv import fields, osv
600+from openerp.osv import orm
601 from tools.translate import _
602-from datetime import datetime, timedelta
603-import time
604-
605-
606-class project_issue(osv.osv):
607+
608+
609+class project_issue(orm.Model):
610 _inherit = 'project.issue'
611- _columns = {
612- #added fields:
613- 'functional_block_id': fields.many2one('project.functional_block', 'Component', help = "Component (system, module, function) to be adressed"),
614- 'assigned_to': fields.related('task_id', 'user_id', string = 'Task Assigned to', type="many2one", relation="res.users", store=True, help='This is the current user to whom the related task was assigned'),
615- 'tasks': fields.one2many('project.task', 'issue_id', 'Related tasks', help="Task history for the issue"),
616- 'create_uid': fields.many2one('res.users', 'Created by', help = "Person who reported the issue"),
617- #modified fields:
618- 'categ_id': fields.many2one('crm.case.categ', 'Category', required=True,
619- domain="[('object_id.model','=','project.issue')]",
620- help="Only categories with a parent will be selectable in the Issues form."),
621- }
622-
623- def case_open(self, cr, uid, ids, *args):
624- """Open Issue preserving the assigned user_id.
625- Standard project_issue.case_open() method forces user_id to the current user.
626- This is not appropriate in the case where an administrative user is updating issue status.
627- With this enhancement, the original user_id is preserved.
628- """
629- orig = self.read(cr, uid, ids, ['id', 'user_id'])
630- res = super(project_issue, self).case_open(cr, uid, ids, *args)
631- for rec in orig:
632- if rec['user_id'] and rec['user_id'][0]:
633- #Write both 'user_id' and 'date_open' to allow Action Rule Triggers to ignore these changes using "... and not vals.get('date_open')"
634- self.write(cr, uid, [rec['id']], {'date_open': time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id' : rec['user_id'][0]} )
635- return res
636-
637- def _validate_tasks_inactive(self, cr, uid, ids):
638- """Ensure there are no related active Tasks"""
639- for issue in self.browse(cr, uid, ids):
640- for task in issue.tasks:
641- if task.state not in ['done', 'cancel']:
642- raise osv.except_osv(_('Error !'), _('All related tasks should be inactive. Please check Task "%s".' % task.name))
643-
644- def case_cancel(self, cr, uid, ids, *args):
645- self._validate_tasks_inactive(cr, uid, ids)
646- return super(project_issue, self).case_cancel(cr, uid, ids, *args)
647-
648- def case_close(self, cr, uid, ids, *args):
649- self._validate_tasks_inactive(cr, uid, ids)
650- return super(project_issue, self).case_close(cr, uid, ids, *args)
651-
652- def onchange_partner_id(self, cr, uid, ids, part, email=False, proj_id=None, context=None):
653- """This function returns value of partner address based on partner
654- :param ids: List of case IDs
655- :param part: Partner's id
656- :param email: Partner's email ID
657- """
658- #the Issue Address is copied from the project's Contact Address
659- if proj_id:
660- data = {}
661- proj_obj = self.pool.get('project.project').browse(cr, uid, proj_id, context)
662- #Copy address from Project
663- contact_id = proj_obj.contact_id and proj_obj.contact_id.id or None
664- data.update( {'partner_address_id': contact_id} )
665- #Copy "reply_to" email from Project, if none already provided
666- if not email:
667- email = proj_obj.reply_to
668- if email:
669- data.update({'email_from': email})
670- return {'value': data}
671- #else:
672- return super(project_issue, self).onchange_partner_id(cr, uid, ids, part, email)
673-
674- def on_change_project(self, cr, uid, ids, proj_id=False, context=None):
675- """When changing the Issue's Project:
676- - the Issue Partner is copied from the project's Partner
677- - cascades the change to the Address and e-mail
678- """
679- if not proj_id:
680- return {'value':{}}
681- super_res = super(project_issue, self).on_change_project(cr, uid, ids, proj_id, context = context)
682- data = super_res.get('value', {})
683- #the Issue Partner is copied from the project's Partner
684- proj_obj = self.pool.get('project.project').browse(cr, uid, proj_id, context)
685- if proj_obj.partner_id:
686- data.update( {'partner_id': proj_obj.partner_id.id} )
687- #the Issue Address is copied from the project's Contact Address
688- #TODO: code repeated in onchange_partner_id(); check if it's really necessary
689- contact_id = proj_obj.contact_id and proj_obj.contact_id.id or None
690- data.update( {'partner_address_id': contact_id} )
691- #cascades the change to the Address and e-mail
692- data.update( self.onchange_partner_id(cr, uid, ids, None, proj_id)['value'] )
693- return {'value': data}
694-
695- def convert_issue_task(self, cr, uid, ids, context=None):
696- for bug in self.browse(cr, uid, ids, context=context):
697- if bug.task_id:
698- new_task_id = bug.task_id.id
699- else:
700- #Task,user_id must be current user; otherwise Task Access Rules may stop task.create
701- #Task date start defaults to tomorrow 00:00h
702- now = datetime.now()
703- date_start = datetime( now.year, now.month, now.day, 0) + timedelta(days=+1)
704- new_task_id = self.pool.get('project.task').create(cr, uid, {
705- 'section_id': bug.section_id.id,
706- 'project_id': bug.project_id.id,
707- 'partner_id': bug.partner_id.id,
708- 'categ_id': bug.categ_id.id,
709- 'functional_block_id': bug.functional_block_id.id,
710- 'date_deadline': bug.date_deadline,
711- 'date_start': date_start, #changed from standard
712- 'planned_hours': 1, #added
713- 'name': bug.name,
714- 'description':bug.description,
715- 'issue_id': bug.id, #added
716- 'priority': bug.priority,
717- 'user_id': uid, #changed
718- })
719- self.write(cr, uid, [bug.id], {'task_id': new_task_id})
720- self.case_open(cr, uid, [bug.id])
721-
722- data_obj = self.pool.get('ir.model.data')
723- form_id = data_obj.get_object(cr, uid, 'project', 'view_task_form2').id
724- tree_id = data_obj.get_object(cr, uid, 'project', 'view_task_tree2').id
725- srch_id = data_obj.get_object(cr, uid, 'project', 'view_task_search_form').id
726- return {
727- 'name': _('Tasks'),
728+
729+ def action_create_task(self, cr, uid, ids, context=None):
730+ """
731+ Create and a related Task for the visit report, and open it's Form.
732+ """
733+ rec = self.browse(cr, uid, ids[0], context)
734+ assert not rec.task_id, _("A Task is already assigned to the Issue!")
735+
736+ rec_fields = ['project_id', 'analytic_account_id', 'location_id']
737+ task_data = dict([(x, getattr(rec, x).id) for x in rec_fields
738+ if hasattr(rec, x) and getattr(rec, x)])
739+ task_data['name'] = _('Report for %s') % rec.name
740+ task_data['issue_id'] = rec.id
741+ task_data['categ_ids'] = [(6, 0, [x.id for x in rec.categ_ids])]
742+
743+ task_model = self.pool.get('project.task')
744+ task_id = task_model.create(cr, uid, task_data, context=context)
745+ rec.write({'task_id': task_id}, context=context)
746+ res = {
747+ 'name': _('Issue Task Report'),
748 'view_type': 'form',
749- 'view_mode': 'form,tree',
750+ 'view_mode': 'form',
751 'res_model': 'project.task',
752- 'res_id': int(new_task_id),
753- 'view_id': False,
754- 'views': [(form_id,'form'),(tree_id,'tree'),(False,'calendar'),(False,'graph')],
755- 'type': 'ir.actions.act_window',
756- 'search_view_id': srch_id,
757- 'nodestroy': True
758- }
759-
760- def convert_issue_task_tree(self, cr, uid, ids, context=None):
761- """Create Task from Issue, without opening it's form"""
762- self.convert_issue_task(cr, uid, ids, context=context)
763- return True
764-
765-project_issue()
766-
767-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
768+ 'res_id': task_id,
769+ 'type': 'ir.actions.act_window'}
770+ return res
771+
772+ def case_cancel(self, cr, uid, ids, context=None):
773+ """ On Issue Cancel, also Cancel Task """
774+ task_ids = [issue.task_id.id
775+ for issue in self.browse(cr, uid, ids, context=context)
776+ if issue.task_id]
777+ self.pool.get('project.task').case_cancel(
778+ cr, uid, task_ids, context=context)
779+ return super(project_issue, self).case_cancel(
780+ cr, uid, ids, context=context)
781
782=== modified file 'project_issue_task/project_issue_view.xml' (properties changed: +x to -x)
783--- project_issue_service/project_issue_view.xml 2012-12-20 12:06:22 +0000
784+++ project_issue_task/project_issue_view.xml 2014-02-25 12:39:41 +0000
785@@ -1,174 +1,20 @@
786 <?xml version="1.0" encoding="utf-8"?>
787 <openerp>
788 <data>
789-
790+
791 <!--PROJECT ISSUE FORM -->
792- <record id="project_issue_form_view_dreis" model="ir.ui.view">
793- <field name="name">project_issue_form_view_dreis</field>
794+ <record id="project_issue_form_view_task" model="ir.ui.view">
795+ <field name="name">project_issue_form_view_task</field>
796 <field name="model">project.issue</field>
797 <field name="inherit_id" ref="project_issue.project_issue_form_view"/>
798 <field name="arch" type="xml">
799
800- <field name="categ_id" position="replace"/>
801- <field name="name" position="replace">
802- <field name="name" colspan="4"/>
803- <field name="functional_block_id" select="1" required="1" widget="selection"/>
804- <field name="categ_id" widget="selection" domain="[('object_id.model','=','project.issue')]"/>
805- <!--... domain="[('object_id.model', '=', 'project.issue'),('parent_id','!=',None)]" -->
806- <field name="create_uid" readonly="1"/>
807- </field>
808- <field name="project_id" position="attributes">
809- <attribute name="colspan">4</attribute>
810- </field>
811-
812- <field name="version_id" position="attributes">
813- <attribute name="groups">base.group_extended</attribute>
814- </field>
815-
816- <!-- Partner Address: add domain -->
817- <field name="partner_id" position="replace">
818- <field name="partner_id" on_change="onchange_partner_id(partner_id, email_from, project_id)" required="1"/>
819- </field>
820- <field name="partner_address_id" position="replace">
821- <field name="partner_address_id" string="Address" required="1"
822- on_change="onchange_partner_address_id(partner_address_id, email_from)"
823- domain="[('partner_id','=',partner_id)]"/>
824- </field>
825- <field name="priority" position="after">
826- <field name="section_id" string="Service Team" groups="base.group_extended"/>
827- </field>
828-
829- <!-- Create task Button -->
830- <field name="task_id" position="attributes">
831- <attribute name="string">Current Task</attribute>
832- </field>
833- <xpath expr='//button[@name="convert_issue_task"]' position="replace">
834- <button name="convert_issue_task" string="Create Task" icon="gtk-index" type="object" attrs="{'invisible':['|',('task_id','!=',False), ('state','in',['cancel','done'])]}"/>
835- </xpath>
836-
837- <!-- Modify existing buttons -->
838- <button name="case_cancel" position="attributes">
839- <attribute name="states">draft,open</attribute>
840- <!--attribute name="type">workflow</attribute-->
841- </button>
842- <button name="case_open" position="attributes">
843- <attribute name="states">draft,pending</attribute>
844- <!--attribute name="type">workflow</attribute-->
845- </button>
846- <button name="case_pending" position="attributes">
847- <attribute name="states">open</attribute>
848- <!--attribute name="type">workflow</attribute-->
849- </button>
850- <button name="case_close" position="attributes">
851- <attribute name="states">open</attribute>
852- <!--attribute name="type">workflow</attribute-->
853- </button>
854- <!-- button name="case_reset" position="replace"/> -->
855-
856- <xpath expr='//page[@string="Communication &amp; History"]' position="attributes">
857- <attribute name="groups"/>
858- </xpath>
859- <!-- ###BUG https://bugs.launchpad.net/openobject-addons/+bug/944879 -->
860- <field name="email_cc" position="attributes">
861- <attribute name="widget">email</attribute>
862- </field>
863-
864- <!-- Task History tab-->
865- <xpath expr='//page[@string="Extra Info"]' position="before">
866- <page string="Task History">
867- <field name="tasks" nolabel="1" readonly="1"/>
868- </page>
869- </xpath>
870-
871- </field>
872- </record>
873-
874- <!--PROJECT ISSUE SEARCH -->
875- <record id="view_project_issue_filter_dreis" model="ir.ui.view">
876- <field name="name">Project Issue Tracker Search</field>
877- <field name="model">project.issue</field>
878- <field name="inherit_id" ref="project_issue.view_project_issue_filter"/>
879- <field name="arch" type="xml">
880-
881- <!-- "To-Do" button relabeled to "In Progress" -->
882- <filter name="todo" position="attributes">
883- <attribute name="string">Open</attribute>
884- </filter>
885- <!-- name filter -->
886- <field name="name" position="replace">
887- <field name="name" string="Issue" colspan="2"
888- filter_domain="['|','|','|',('project_id','ilike',self), ('partner_id','ilike',self), ('email_from','ilike',self), ('name','ilike',self)]"
889- />
890- </field>
891- <!-- user_id buttons with same order as Tasks (BUGFIX to report) -->
892- <field name="user_id" position="replace">
893- <field name="user_id" filter_domain="['|',('user_id','=',self),('create_uid','=',self)]" string="User">
894- <filter domain="['|',('user_id','=',uid),('create_uid','=',uid)]" help="My Issues" icon="terp-personal" />
895- <filter domain="[('user_id','=',False)]" help="Unassigned Issues" icon="terp-personal-" groups="project.group_project_manager"/>
896- </field>
897- </field>
898- <field name="project_id" position="replace"/>
899-
900- <!-- Search by "ref" instead of "id"; add section_id (Team) -->
901- <field name="id" position="replace">
902- <field name="section_id" string="Team" widget="selection" groups="base.group_extended"/>
903- </field>
904- <!-- GROUP BY -->
905- <filter string="Partner" position="after">
906- <filter string="Team" icon="STOCK_SELECT_COLOR" domain="[]" context="{'group_by':'section_id'}"/>
907- </filter>
908- </field>
909- </record>
910-
911- <!--PROJECT ISSUE TREE -->
912- <record model="ir.ui.view" id="project_issue_tree_view_reis">
913- <field name="name">Project Issue Tracker Tree</field>
914- <field name="model">project.issue</field>
915- <field name="inherit_id" ref="project_issue.project_issue_tree_view"/>
916- <field name="arch" type="xml">
917- <data>
918- <!-- Colors like Task Tree -->
919- <!-- TODO: red for surpassed dealines -->
920- <tree position="attributes">
921- <attribute name="colors">grey:state in ('cancel','done');blue:state == 'pending'</attribute>
922- </tree>
923- <!-- Internal ID, Version and Stage visible only in Extended mode -->
924- <field name="id" position="attributes"><attribute name="invisible">1</attribute></field>
925- <field name="type_id" position="attributes"><attribute name="groups">base.group_extended</attribute></field>
926- <button name="prev_type" position="attributes"><attribute name="groups">base.group_extended</attribute></button>
927- <button name="next_type" position="attributes"><attribute name="groups">base.group_extended</attribute></button>
928- <field name="version_id" position="attributes"><attribute name="groups">base.group_extended</attribute></field>
929- <field name="categ_id" position="attributes"><attribute name="groups">base.group_extended</attribute></field>
930- <!-- Ref and Category visible after issue name -->
931- <field name="user_id" position="after">
932- <field name="section_id" groups="base.group_extended"/>
933- <field name="create_uid"/>
934- </field>
935- <!-- State buttons equal to Task Tree -->
936- <button name="case_cancel" position="replace"/>
937- <button name="case_close" position="replace"/>
938- <button name="case_pending" position="replace"/>
939- <button name="case_escalate" position="replace"/>
940- <button name="case_reset" position="replace"/>
941- <button name="case_open" position="replace">
942- <button name="convert_issue_task_tree" string="Create Task" icon="gtk-index" type="object"
943- attrs="{'invisible':['|',('task_id','!=',False), ('state','in',['cancel','done'])]}"/>
944- <button name="case_open" string="Open" states="draft,pending" type="object"
945- icon="gtk-media-play" help="Moves to state In Progress" groups="base.group_extended"/>
946- <button name="case_close" string="Done" states="open" type="object"
947- icon="terp-dialog-close"/>
948- </button>
949-
950- </data>
951- </field>
952- </record>
953-
954- <!-- ISSUE KANBAN VIEW: moving from first to last position-->
955- <record model="ir.actions.act_window.view" id="project_issue.action_crm_tag_kanban_view0">
956- <field name="sequence" eval="10"/>
957- </record>
958- <!-- -->
959+ <field name="task_id" position="after">
960+ <button type="object" name="action_create_task" string="Task Report" attrs="{'invisible': [('task_id', '!=', False)]}"/>
961+ </field>
962+
963+ </field>
964+ </record>
965
966 </data>
967 </openerp>
968-
969
970=== modified file 'project_issue_task/project_task.py' (properties changed: +x to -x)
971--- project_issue_service/project_task.py 2012-11-22 13:29:38 +0000
972+++ project_issue_task/project_task.py 2014-02-25 12:39:41 +0000
973@@ -1,7 +1,7 @@
974 # -*- coding: utf-8 -*-
975 ##############################################################################
976-#
977-# Copyright (C) 2012 Daniel Reis
978+#
979+# Copyright (C) 2012 - 2013 Daniel Reis
980 #
981 # This program is free software: you can redistribute it and/or modify
982 # it under the terms of the GNU Affero General Public License as
983@@ -18,74 +18,37 @@
984 #
985 ##############################################################################
986
987-from crm import crm
988-from osv import fields, osv
989-from datetime import datetime, timedelta
990-
991-###TASK_TYPE_USE_GROUPS = [('resolution', 'Resolution Stage'), ('cause', 'Problem Cause')]
992-
993-#class project_task_type(osv.osv):
994-# _inherit = 'project.task.type'
995-# _sort = 'use_group, sequence'
996-# _columns = {
997-# 'use_group': fields.selection( TASK_TYPE_USE_GROUPS , 'Usage', size=16),
998-# 'code': fields.char('Code', size=10),
999-# }
1000-#project_task_type()
1001-
1002-
1003-#class project_functional_block(osv.osv):
1004-# _inherit = 'project.functional_block'
1005-# _columns = {
1006-# 'code': fields.char('Code', size=10),
1007-# }
1008-#project_functional_block()
1009-
1010-class task(osv.osv):
1011+from openerp.osv import fields, orm
1012+
1013+
1014+class task(orm.Model):
1015 _inherit = "project.task"
1016+
1017+ def _fld_issue_id(self, cr, uid, ids, field, arg, context=None):
1018+ res = {}
1019+ issue_model = self.pool.get('project.issue')
1020+ for doc in self.browse(cr, uid, ids, context=context):
1021+ issue_id = issue_model.search(
1022+ cr, uid, [('task_id', '=', doc.id)], context=context)
1023+ if issue_id:
1024+ res[doc.id] = issue_id[0]
1025+ else:
1026+ res[doc.id] = None
1027+ return res
1028+
1029 _columns = {
1030- #modified fields:
1031- 'section_id': fields.many2one('crm.case.section', 'Service Team', select=True,\
1032- help='Service team to which Task belongs to.'), #standard: relabeled
1033- 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), #Standard is 0-4; changed to conform with project_issue (1-5)!
1034- #added fields:
1035- 'issue_id': fields.many2one('project.issue', 'Related Issue', readonly=True,
1036- help="Issue related to this task"),
1037- 'categ_id': fields.related('issue_id', 'categ_id', string='Issue Category', type="many2one", relation='crm.case.categ', store=True),
1038- }
1039-
1040- def do_close(self, cr, uid, ids, context=None):
1041- """
1042- Clean up related Issues's 'Current Task', and set issue state to either
1043- 'done' or 'pending', if pending work is described in the 'todo_desc' field.
1044- """
1045- #Tasks must be closed first, because Issues with active tasks can't be closed
1046- res = super(task, self).do_close(cr, uid, ids, context)
1047- #Update related issue state
1048- issue_model = self.pool.get('project.issue')
1049- for tsk in self.browse(cr, uid, ids):
1050- if tsk.issue_id and tsk.issue_id.state not in ['done', 'cancel']:
1051- #Current task cleaned up, so that the "Create Task" button is shown again
1052- issue_model.write(cr, uid, [tsk.issue_id.id], {'task_id': None}, context=context)
1053- #If pending work, issue is not closed, but set to "PENDING"
1054- if tsk.todo_desc:
1055- issue_model.case_pending(cr, uid, [tsk.issue_id.id])
1056- else:
1057- issue_model.case_close(cr, uid, [tsk.issue_id.id])
1058- return res
1059-
1060- def do_cancel(self, cr, uid, ids, context=None):
1061- """
1062- Clean up related Issues's 'Current Task'
1063- """
1064- issue_model = self.pool.get('project.issue')
1065- for tsk in self.browse(cr, uid, ids):
1066- if tsk.issue_id and tsk.issue_id.state not in ['closed', 'cancelled']:
1067- issue_model.write(cr, uid, [tsk.issue_id.id], {'task_id': None}, context=context)
1068- return super(task, self).do_cancel(cr, uid, ids, context)
1069-
1070-task()
1071-
1072-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1073-
1074-
1075+ 'issue_id': fields.function(
1076+ _fld_issue_id, string="Related Issue",
1077+ type="many2one", relation="project.issue", store=True),
1078+ 'ref': fields.char('Reference', 20),
1079+ 'reason_id': fields.many2one('project.task.cause', 'Problem Cause'),
1080+ }
1081+
1082+ def action_close(self, cr, uid, ids, context=None):
1083+ """ On Task Close, also close Issue """
1084+ issue_ids = [x.issue_id.id
1085+ for x in self.browse(cr, uid, ids, context=context)
1086+ if x.issue_id]
1087+ self.pool.get('project.issue').case_close(
1088+ cr, uid, issue_ids, context=context)
1089+ return super(task, self).action_close(cr, uid, ids, context=context)
1090
1091=== renamed file 'project_task_service/project_task_cause.py' => 'project_issue_task/project_task_cause.py' (properties changed: +x to -x)
1092--- project_task_service/project_task_cause.py 2012-11-22 13:29:38 +0000
1093+++ project_issue_task/project_task_cause.py 2014-02-25 12:39:41 +0000
1094@@ -1,6 +1,6 @@
1095 # -*- coding: utf-8 -*-
1096 ##############################################################################
1097-#
1098+#
1099 # Copyright (C) 2012 Daniel Reis
1100 #
1101 # This program is free software: you can redistribute it and/or modify
1102@@ -18,11 +18,12 @@
1103 #
1104 ##############################################################################
1105
1106-from osv import fields, osv
1107-
1108-class project_task_cause(osv.osv):
1109+from openerp.osv import fields, orm
1110+
1111+
1112+class project_task_cause(orm.Model):
1113 _name = 'project.task.cause'
1114- _description = 'Incident Cause'
1115+ _description = 'Issue Cause'
1116 _order = 'sequence'
1117 _columns = {
1118 'name': fields.char('Cause', required=True, size=64, translate=True),
1119@@ -33,8 +34,3 @@
1120 _defaults = {
1121 'sequence': 10
1122 }
1123-project_task_cause()
1124-
1125-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1126-
1127-
1128
1129=== renamed file 'project_task_service/project_task_cause_view.xml' => 'project_issue_task/project_task_cause_view.xml' (properties changed: +x to -x)
1130--- project_task_service/project_task_cause_view.xml 2012-11-22 14:24:56 +0000
1131+++ project_issue_task/project_task_cause_view.xml 2014-02-25 12:39:41 +0000
1132@@ -6,39 +6,48 @@
1133 <record id="task_cause_edit" model="ir.ui.view">
1134 <field name="name">project.task.cause.form</field>
1135 <field name="model">project.task.cause</field>
1136- <field name="type">form</field>
1137 <field name="arch" type="xml">
1138- <form string="Task Incident Causes">
1139+
1140+ <form string="Task Issue Causes">
1141+ <group>
1142+ <group>
1143 <field name="name"/>
1144+ <field name="description"/>
1145+ </group>
1146+ <group>
1147 <field name="sequence"/>
1148 <field name="code"/>
1149- <separator string="Description" colspan="4"/>
1150- <field colspan="4" name="description" nolabel="1"/>
1151- </form>
1152+ </group>
1153+ </group>
1154+ </form>
1155+
1156 </field>
1157 </record>
1158
1159 <record id="task_cause_tree" model="ir.ui.view">
1160 <field name="name">project.task.cause.tree</field>
1161- <field name="model">project.cause.type</field>
1162- <field name="type">tree</field>
1163+ <field name="model">project.task.cause</field>
1164 <field name="arch" type="xml">
1165- <tree string="Task Incident Causes">
1166+
1167+ <tree string="Task Issue Causes">
1168 <field name="sequence"/>
1169 <field name="code"/>
1170 <field name="name"/>
1171 </tree>
1172+
1173 </field>
1174 </record>
1175
1176 <record id="open_task_cause_form" model="ir.actions.act_window">
1177- <field name="name">Causes</field>
1178+ <field name="name">Task Issue Causes</field>
1179 <field name="res_model">project.task.cause</field>
1180 <field name="view_type">form</field>
1181 <field name="view_id" ref="task_cause_tree"/>
1182 </record>
1183
1184- <menuitem action="open_task_cause_form" id="menu_task_cause_view" parent="project.menu_project_config_project" sequence="3"/>
1185+ <menuitem action="open_task_cause_form"
1186+ id="menu_task_cause_view"
1187+ parent="base.menu_definitions"/>
1188
1189 </data>
1190 </openerp>
1191
1192=== modified file 'project_issue_task/project_task_view.xml' (properties changed: +x to -x)
1193--- project_issue_service/project_task_view.xml 2012-11-22 14:24:56 +0000
1194+++ project_issue_task/project_task_view.xml 2014-02-25 12:39:41 +0000
1195@@ -2,50 +2,25 @@
1196 <openerp>
1197 <data>
1198
1199- <!--PROJECT TASK CATEGORIES -->
1200- <record id="project_task_categ_action" model="ir.actions.act_window">
1201- <field name="name">Task Categories</field>
1202- <field name="res_model">crm.case.categ</field>
1203- <field name="view_type">form</field>
1204- <field name="view_id" ref="crm.crm_case_categ_tree-view"/>
1205- <field name="domain">[('object_id.model', '=', 'project.task')]</field>
1206- <field name="context" eval="{'object_id': ref('project.model_project_task')}"/>
1207- </record>
1208- <menuitem action="project_task_categ_action" name="Categories" id="menu_project_task_category_act" parent="project.menu_project_config_project" />
1209-
1210-
1211- <!-- TASK FORM -->
1212- <record id="view_project_task_form_dreis" model="ir.ui.view">
1213- <field name="name">project.task.form.dreis</field>
1214+ <record id="view_project_task_form_issue" model="ir.ui.view">
1215+ <field name="name">project.task.form.issue</field>
1216 <field name="model">project.task</field>
1217 <field name="inherit_id" ref="project.view_task_form2"/>
1218 <field name="arch" type="xml">
1219- <field name="progress" position="after">
1220+
1221+ <field name="date_deadline" position="before">
1222+ <field name="ref"/>
1223+ </field>
1224+ <field name="partner_id" position="after">
1225 <field name="issue_id"/>
1226- <field name="categ_id" widget="selection"
1227- domain="['|',('object_id.model', '=', 'project.task'),('object_id.model', '=', 'project.issue'),('parent_id','!=',None)]"/>
1228- </field>
1229- <field name="partner_id" position="after">
1230- <field name="section_id"/>
1231- </field>
1232- <field name="description" position="attributes">
1233- <attribute name="attrs">{'readonly':[('state','!=','draft')]}</attribute>
1234- </field>
1235- </field>
1236- </record>
1237+ </field>
1238+ <field name="description" position="before">
1239+ <group>
1240+ <field name="reason_id"
1241+ attrs="{'invisible': [('issue_id','=',False)]}"/>
1242+ </group>
1243+ </field>
1244
1245- <!-- TASK TREE -->
1246- <record id="view_task_tree2" model="ir.ui.view">
1247- <field name="name">project.task.tree</field>
1248- <field name="model">project.task</field>
1249- <field name="inherit_id" ref="project.view_task_tree2"/>
1250- <field name="arch" type="xml">
1251-
1252- <field name="user_id" position="after">
1253- <field name="date_start"/>
1254- <field name="date_end"/>
1255- </field>
1256-
1257 </field>
1258 </record>
1259
1260
1261=== renamed directory 'project_task_service/security' => 'project_issue_task/security'
1262=== modified file 'project_issue_task/security/ir.model.access.csv' (properties changed: +x to -x)
1263--- project_task_service/security/ir.model.access.csv 2012-11-22 13:29:38 +0000
1264+++ project_issue_task/security/ir.model.access.csv 2014-02-25 12:39:41 +0000
1265@@ -1,3 +1,3 @@
1266 "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
1267 "access_project_task_cause_project_manager","project_task_cause_project_manager","model_project_task_cause","project.group_project_manager",1,1,1,1
1268-"access_project_task_cause_project_user","project_task_cause_project_user","model_project_task_cause","project.group_project_user",1,0,0,0
1269+"access_project_task_cause_project_user","project_task_cause_project_user","model_project_task_cause","base.group_user",1,0,0,0
1270
1271=== added file 'project_issue_task/security/project_security.xml'
1272--- project_issue_task/security/project_security.xml 1970-01-01 00:00:00 +0000
1273+++ project_issue_task/security/project_security.xml 2014-02-25 12:39:41 +0000
1274@@ -0,0 +1,30 @@
1275+<?xml version="1.0" encoding="utf-8"?>
1276+<openerp>
1277+ <data noupdate="1">
1278+
1279+
1280+ <record model="ir.rule" id="issue_related_task_employee">
1281+ <field name="name">Project/Task: Employees can view Issue's related Task</field>
1282+ <field name="model_id" ref="project.model_project_task"/>
1283+ <field name="groups" eval="[(4,ref('base.group_user'))]"/>
1284+ <field name="domain_force">[('issue_id.message_follower_ids', 'in', [user.partner_id.id])]</field>
1285+ <field name="perm_read" eval="True"/>
1286+ <field name="perm_create" eval="False"/>
1287+ <field name="perm_write" eval="False"/>
1288+ <field name="perm_unlink" eval="False"/>
1289+ </record>
1290+
1291+ <record model="ir.rule" id="issue_related_task_project_user">
1292+ <field name="name">Project/Task: Project Users can edit Issue's related Task</field>
1293+ <field name="model_id" ref="project.model_project_task"/>
1294+ <field name="groups" eval="[(4,ref('project.group_project_user'))]"/>
1295+ <field name="domain_force">[('issue_id.message_follower_ids', 'in', [user.partner_id.id])]</field>
1296+ <field name="perm_read" eval="True"/>
1297+ <field name="perm_create" eval="True"/>
1298+ <field name="perm_write" eval="True"/>
1299+ <field name="perm_unlink" eval="True"/>
1300+ </record>
1301+
1302+
1303+ </data>
1304+</openerp>
1305
1306=== removed directory 'project_task_service'
1307=== removed file 'project_task_service/__init__.py'
1308--- project_task_service/__init__.py 2012-11-22 13:29:38 +0000
1309+++ project_task_service/__init__.py 1970-01-01 00:00:00 +0000
1310@@ -1,4 +0,0 @@
1311-# -*- coding: utf-8 -*-
1312-import project_task_cause
1313-import project_task
1314-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1315
1316=== removed file 'project_task_service/__openerp__.py'
1317--- project_task_service/__openerp__.py 2013-03-04 16:16:31 +0000
1318+++ project_task_service/__openerp__.py 1970-01-01 00:00:00 +0000
1319@@ -1,52 +0,0 @@
1320-# -*- coding: utf-8 -*-
1321-##############################################################################
1322-#
1323-# Copyright (C) 2012 Daniel Reis
1324-#
1325-# This program is free software: you can redistribute it and/or modify
1326-# it under the terms of the GNU Affero General Public License as
1327-# published by the Free Software Foundation, either version 3 of the
1328-# License, or (at your option) any later version.
1329-#
1330-# This program is distributed in the hope that it will be useful,
1331-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1332-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1333-# GNU Affero General Public License for more details.
1334-#
1335-# You should have received a copy of the GNU Affero General Public License
1336-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1337-#
1338-##############################################################################
1339-
1340-{
1341- 'name': 'Project Task Record',
1342- 'version': '1.0',
1343- "category": "Project Management",
1344- 'description': """\
1345-Add to project tasks all necessary fields to record a service intervention:
1346-* Time spent
1347-* Materials used
1348-* Work done description
1349-* Work pending description
1350-* Problem cause identification
1351-
1352-Before creating new Projects, review the following configurations::
1353-* Stages: the task stages ""common to all projects" are assigned to new projects by default.
1354-* Causes: the possible reasons for problem causing a service incidents.
1355-* Functional Blocks: the sub-components or sub-systems for projects.
1356-
1357-Contributions are appreciated. Some ideas to develop:
1358-* add a 'crm_category_stages' module, to make configurable the stages (type_ids) valid for each Category.
1359-""",
1360- 'author': 'Daniel Reis',
1361- 'website': 'daniel.reis@securitas.pt',
1362- 'depends': ['project', 'project_functional_blocks', 'project_department'],
1363- 'update_xml': [
1364- 'project_task_cause_view.xml',
1365- 'project_task_view.xml',
1366- 'security/ir.model.access.csv',
1367- ],
1368- 'installable': False,
1369- 'application': False,
1370-}
1371-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1372
1373=== removed file 'project_task_service/project_task.py'
1374--- project_task_service/project_task.py 2012-11-22 13:29:38 +0000
1375+++ project_task_service/project_task.py 1970-01-01 00:00:00 +0000
1376@@ -1,88 +0,0 @@
1377-# -*- coding: utf-8 -*-
1378-##############################################################################
1379-#
1380-# Copyright (C) 2012 Daniel Reis
1381-#
1382-# This program is free software: you can redistribute it and/or modify
1383-# it under the terms of the GNU Affero General Public License as
1384-# published by the Free Software Foundation, either version 3 of the
1385-# License, or (at your option) any later version.
1386-#
1387-# This program is distributed in the hope that it will be useful,
1388-# but WITHOUT ANY WARRANTY; without even the implied warranty of
1389-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1390-# GNU Affero General Public License for more details.
1391-#
1392-# You should have received a copy of the GNU Affero General Public License
1393-# along with this program. If not, see <http://www.gnu.org/licenses/>.
1394-#
1395-##############################################################################
1396-
1397-from osv import fields, osv
1398-from datetime import datetime, timedelta
1399-
1400-class task(osv.osv):
1401- #FUTURE: use task recurrency, to generate maintenance plans
1402- #FUTURE: Apply maintenance plan templates (use Project templates?)
1403- _inherit = "project.task"
1404- _columns = {
1405- #modified fields:
1406- 'functional_block_id': fields.many2one('project.functional_block', 'Component',
1407- help = "Component (system, module, function) to be addressed"),
1408- #added fields:
1409- 'ref': fields.char('Code', 20, help="Service Order number"),
1410- 'report_desc': fields.text('Work description'),
1411- 'todo_desc': fields.text('Pending issues description'),
1412- 'reason_id': fields.many2one('project.task.cause', 'Problem Cause', \
1413- help='Cause for the incident that made this task necessary. Available list depends on the Task Type.'),
1414- }
1415-
1416- def do_close(self, cr, uid, ids, context=None):
1417- #Automatically adjust Task Start and End dates based on Work details:
1418- for t in self.browse(cr, uid, ids, context=context):
1419- task_dts = t.date_start
1420- task_dte = t.date_end or t.date_start
1421- for w in t.work_ids:
1422- #Task start date should not be later than the oldest work line
1423- work_dts = w.date
1424- task_dts = min(task_dts, work_dts) or work_dts
1425- #Task end date should not be before the last work line
1426- d = datetime.strptime(w.date, '%Y-%m-%d %H:%M:%S') \
1427- + timedelta(seconds=round(w.hours*3600) )
1428- work_dte = d.strftime('%Y-%m-%d %H:%M:%S')
1429- task_dte = max(task_dte, work_dte) or work_dte
1430- vals = {'date_start': task_dts, 'date_end': task_dte}
1431- self.write(cr, uid, [t.id],vals, context=context)
1432- return super(task, self).do_close(cr, uid, ids, context)
1433-
1434-task()
1435-
1436-
1437-class project_work(osv.osv):
1438- #Changed Task work default Date to Y-m-d
1439- _inherit = "project.task.work"
1440- _defaults = {
1441- 'date': lambda *a: datetime.now().strftime('%Y-%m-%d'),
1442- }
1443-project_work()
1444-
1445-
1446-class project_task_type(osv.osv):
1447- _inherit = 'project.task.type'
1448- _columns = {
1449- 'code': fields.char('Code', size=10),
1450- }
1451-project_task_type()
1452-
1453-
1454-class project_functional_block(osv.osv):
1455- _inherit = 'project.functional_block'
1456- _columns = {
1457- 'code': fields.char('Code', size=10),
1458- }
1459-project_functional_block()
1460-
1461-
1462-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
1463-
1464-
1465
1466=== removed file 'project_task_service/project_task_view.xml'
1467--- project_task_service/project_task_view.xml 2012-11-22 13:29:38 +0000
1468+++ project_task_service/project_task_view.xml 1970-01-01 00:00:00 +0000
1469@@ -1,152 +0,0 @@
1470-<?xml version="1.0" encoding="utf-8"?>
1471-<openerp>
1472- <data>
1473-
1474- <!-- Task type CODE -->
1475- <record id="task_type_edit_dreis" model="ir.ui.view">
1476- <field name="name">project.task.type.form.dreis</field>
1477- <field name="model">project.task.type</field>
1478- <field name="inherit_id" ref="project.task_type_edit"/>
1479- <field name="arch" type="xml">
1480- <field name="sequence" position="after">
1481- <field name="code"/>
1482- </field>
1483- </field>
1484- </record>
1485-
1486- <!-- Task FORM -->
1487- <record id="view_project_task_form_dreis" model="ir.ui.view">
1488- <field name="name">project.task.form.dreis</field>
1489- <field name="model">project.task</field>
1490- <field name="inherit_id" ref="project.view_task_form2"/>
1491- <field name="arch" type="xml">
1492- <field name="progress" position="after">
1493- <field name="ref" string="Service Order Id"/>
1494- </field>
1495- <!-- State allowed transitions:
1496- draft -> open, cancel
1497- open -> draft, pending, close
1498- pending -> open
1499- close -> draft ("reset"
1500- -->
1501- <button name="do_cancel" position="attributes">
1502- <attribute name="states">draft, open</attribute>
1503- </button>
1504- <button name="do_draft" position="attributes">
1505- <attribute name="states">close,cancel</attribute>
1506- </button>
1507- <button name="do_pending" position="attributes">
1508- <attribute name="states">open</attribute>
1509- </button>
1510- <button name="do_open" position="attributes">
1511- <attribute name="states">draft,pending</attribute>
1512- </button>
1513- <button name="action_close" position="attributes">
1514- <attribute name="states">open</attribute>
1515- </button>
1516-
1517- <field name="type_id" position="replace"/>
1518- <button name="prev_type" position="replace"/>
1519- <button name="next_type" position="replace"/>
1520-
1521- <field name="work_ids" position="replace">
1522- <!-- Task Time spent -->
1523- <field colspan="4" name="work_ids" nolabel="1"
1524- attrs="{'readonly':[('state','in',['done','draft'])]}">
1525- <tree string="Task Work" editable="top">
1526- <field name="date" string="Start Datetime"/>
1527- <field name="hours" widget="float_time" sum="Spent Hours" string="Spent Hours (hh:mm)"/>
1528- <field name="user_id"/>
1529- <field name="name" string="Comments"/>
1530- </tree>
1531- </field>
1532- <!-- Task Work Description -->
1533- <group col="4" colspan="4" attrs="{'invisible':[('state','in',['draft','cancel'])]}">
1534- <separator string="Work Description" colspan="4"/>
1535- <field name="report_desc" nolabel="1" colspan="4"/>
1536- <field name="reason_id" widget="selection"/>
1537- <group col="4" colspan="2">
1538- <field name="type_id" widget="selection" domain="[('code','!=',None)]"/>
1539- <button name="prev_type" string="Previous" type="object" icon="gtk-go-back" help="Change to Previous Stage"/>
1540- <button name="next_type" string="Next" type="object" icon="gtk-go-forward" help="Change to Next Stage"/>
1541- </group>
1542- <label string="Issues to be adressed" colspan="4"/>
1543- <field name="todo_desc" nolabel="1" colspan="4"/>
1544- </group>
1545- </field>
1546- </field>
1547- </record>
1548-
1549- <!-- TASK TREE -->
1550- <record id="view_project_task_tree_dreis" model="ir.ui.view">
1551- <field name="name">project.task.tree.dreis</field>
1552- <field name="model">project.task</field>
1553- <field name="inherit_id" ref="project.view_task_tree2"/>
1554- <field name="arch" type="xml">
1555- <!-- States: OPEN:draft,pending; CLOSE:open,pending -->
1556- <button name="do_open" position="attributes">
1557- <attribute name="states">draft,pending</attribute>
1558- </button>
1559- <button name="action_close" position="attributes">
1560- <attribute name="states">open</attribute>
1561- </button>
1562- </field>
1563- </record>
1564-
1565- <!-- TASK SEARCH -->
1566- <record id="view_project_task_search_dreis" model="ir.ui.view">
1567- <field name="name">project.task.search.dreis</field>
1568- <field name="model">project.task</field>
1569- <field name="inherit_id" ref="project.view_task_search_form"/>
1570- <field name="arch" type="xml">
1571- <field name="project_id" position="replace">
1572- <field name="project_id"
1573- filter_domain="['|','|', ('project_id','ilike',self), ('partner_id','ilike',self), ('name','ilike',self)]"/>
1574- </field>
1575- </field>
1576- </record>
1577-
1578- <!--Task Calendar: project_id before name, uses date_start, not date_deadline-->
1579- <record id="view_task_calendar_reis1" model="ir.ui.view">
1580- <field name="name">project.task.calendar.reis</field>
1581- <field name="model">project.task</field>
1582- <field name="type">calendar</field>
1583- <field eval="1" name="priority"/>
1584- <field name="arch" type="xml">
1585- <calendar color="user_id" date_start="date_start" date_delay="planned_hours" string="Tasks">
1586- <field name="project_id"/>
1587- <field name="name"/>
1588- </calendar>
1589- </field>
1590- </record>
1591-
1592- <!-- TASK MENU ACTION:
1593- * No filter buttons activated by default
1594- * User's "Department_id" selected by default
1595- * Kanban view sequence moved to last
1596- -->
1597- <record id="project.action_view_task" model="ir.actions.act_window">
1598- <field name="name">Tasks</field>
1599- <field name="res_model">project.task</field>
1600- <field name="view_type">form</field>
1601- <field name="view_mode">tree,form,calendar,gantt,graph,kanban</field>
1602- <field eval="False" name="filter"/>
1603- <field name="view_id" eval="False"/>
1604- <field name="context">{"search_default_project_id": project_id, "search_default_department_id": department_id}</field>
1605- <field name="search_view_id" ref="project.view_task_search_form"/>
1606- <field name="help">A task represents a work that has to be done. Each user works in his own list of tasks where he can record his task work in hours. He can work and close the task itself or delegate it to another user. If you delegate a task to another user, you get a new task in pending state, which will be reopened when you have to review the work achieved. If you install the project_timesheet module, task work can be invoiced based on the project configuration. With the project_mrp module, sales orders can create tasks automatically when they are confirmed.</field>
1607- </record>
1608- <record id="project.open_view_task_list_kanban" model="ir.actions.act_window.view">
1609- <field name="sequence" eval="10"/>
1610- </record>
1611-
1612- <!--### REPORT
1613- <report auto="False" id="project_task_webkitreport"
1614- model="project.task"
1615- name="project_task_webkitreport"
1616- file="project_service/report/report_project_task.mako"
1617- string="Print Task Report" report_type="webkit" />
1618- -->
1619-
1620- </data>
1621-</openerp>
1622
1623=== removed directory 'project_task_service/static'
1624=== removed directory 'project_task_service/static/src'
1625=== removed directory 'project_task_service/static/src/img'
1626=== removed file 'project_task_service/static/src/img/icon.png'
1627Binary files project_task_service/static/src/img/icon.png 2012-11-22 13:29:38 +0000 and project_task_service/static/src/img/icon.png 1970-01-01 00:00:00 +0000 differ

Subscribers

People subscribed via source and target branches