Merge lp:~camptocamp/department-mgmt/add-dep-on-project-task-jge into lp:~department-core-editors/department-mgmt/7.0

Proposed by Joël Grand-Guillaume @ camptocamp
Status: Merged
Merged at revision: 18
Proposed branch: lp:~camptocamp/department-mgmt/add-dep-on-project-task-jge
Merge into: lp:~department-core-editors/department-mgmt/7.0
Diff against target: 114 lines (+81/-2)
4 files modified
project_department/__init__.py (+1/-1)
project_department/__openerp__.py (+1/-1)
project_department/project.py (+39/-0)
project_department/project_view.xml (+40/-0)
To merge this branch: bzr merge lp:~camptocamp/department-mgmt/add-dep-on-project-task-jge
Reviewer Review Type Date Requested Status
Pedro Manuel Baeza code review Approve
Guewen Baconnier @ Camptocamp code review Approve
Review via email: mp+217068@code.launchpad.net

Description of the change

Hi,

This little MP adds the department on tasks (and filter, group by) as a related of the project.

Regards,

To post a comment you must log in.
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Hi, Joël,

The MP you have done seems good, but I see a little problem: this modification can give the user a false impression that the department is selected by task, and when they try to change it, they get frustrated, because it's readonly.

I advice to change field label to 'Project department' to avoid this confussion.

Regards.

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

Hi Jöel,

This mainly adds a referenced field for project_id.department_id.
I believe that there is interest in having a future module adding a department_id as a real Task attribute.
Because of this, I support Pedro's opinion on renaming the 'department_id' field to 'project_department_id'.

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

I agree with you guys, thanks for the review. Project departement is better. I'll make the modifications.

19. By Joël Grand-Guillaume @ camptocamp

[IMP] Change Department for Project Department in tasks.

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) :
review: Approve (code review)
Revision history for this message
Pedro Manuel Baeza (pedro.baeza) wrote :

Thanks for the changes!

Regards.

review: Approve (code review)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'project_department/__init__.py'
2--- project_department/__init__.py 2013-02-28 12:24:19 +0000
3+++ project_department/__init__.py 2014-05-08 12:43:36 +0000
4@@ -1,1 +1,1 @@
5-#empty
6+from . import project
7\ No newline at end of file
8
9=== modified file 'project_department/__openerp__.py'
10--- project_department/__openerp__.py 2013-02-28 12:24:19 +0000
11+++ project_department/__openerp__.py 2014-05-08 12:43:36 +0000
12@@ -6,7 +6,7 @@
13 "license": "AGPL-3",
14 "category": "Generic Modules/Projects & Services",
15 "description": """\
16-Add Department to Projects and to corresponding tree, search and form views.
17+Add Department to Projects and task to corresponding tree, search and form views.
18 """,
19 "website": "http://camptocamp.com",
20 "depends": ["project", "analytic_department"],
21
22=== added file 'project_department/project.py'
23--- project_department/project.py 1970-01-01 00:00:00 +0000
24+++ project_department/project.py 2014-05-08 12:43:36 +0000
25@@ -0,0 +1,39 @@
26+# -*- coding: utf-8 -*-
27+##############################################################################
28+#
29+# Copyright (C) 2014 Camptocamp
30+# Author Joel Grand-Guillaume
31+#
32+# This program is free software: you can redistribute it and/or modify
33+# it under the terms of the GNU Affero General Public License as
34+# published by the Free Software Foundation, either version 3 of the
35+# License, or (at your option) any later version.
36+#
37+# This program is distributed in the hope that it will be useful,
38+# but WITHOUT ANY WARRANTY; without even the implied warranty of
39+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40+# GNU Affero General Public License for more details.
41+#
42+# You should have received a copy of the GNU Affero General Public License
43+# along with this program. If not, see <http://www.gnu.org/licenses/>.
44+#
45+##############################################################################
46+
47+from openerp.osv import fields, orm
48+
49+
50+class ProjectTask(orm.Model):
51+
52+ _inherit = 'project.task'
53+ _columns = {
54+ 'project_department_id': fields.related(
55+ 'project_id',
56+ 'department_id',
57+ type='many2one',
58+ relation='hr.department',
59+ string='Project Department',
60+ store=True,
61+ readonly=True),
62+ }
63+
64+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
65
66=== modified file 'project_department/project_view.xml'
67--- project_department/project_view.xml 2013-02-28 12:24:19 +0000
68+++ project_department/project_view.xml 2014-05-08 12:43:36 +0000
69@@ -41,6 +41,46 @@
70 </field>
71 </record>
72
73+ <record id="view_task_search_form" model="ir.ui.view">
74+ <field name="name">project.task.search.form</field>
75+ <field name="model">project.task</field>
76+ <field name="inherit_id" ref="project.view_task_search_form"/>
77+ <field name="arch" type="xml">
78+ <field name="user_id" position="after">
79+ <field name="project_department_id"/>
80+ </field>
81+ <filter string="Users" name="group_user_id" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}" position="after">
82+ <filter string="Project Department" name="group_department_id" icon="terp-personal" domain="[]" context="{'group_by':'project_department_id'}"/>
83+ </filter>
84+ </field>
85+ </record>
86+
87+
88+ <record id="view_task_form2" model="ir.ui.view">
89+ <field name="name">project.task.departement.form</field>
90+ <field name="model">project.task</field>
91+ <field name="inherit_id" ref="project.view_task_form2"/>
92+ <field eval="2" name="priority"/>
93+ <field name="arch" type="xml">
94+ <field name="user_id" attrs="{'readonly':[('state','in',['done', 'cancelled'])]}" options='{"no_open": True}' position="after">
95+ <field name="project_department_id" />
96+ </field>
97+ </field>
98+ </record>
99+
100+ <record id="view_task_tree2" model="ir.ui.view">
101+ <field name="name">project.task.department.tree</field>
102+ <field name="model">project.task</field>
103+ <field name="inherit_id" ref="project.view_task_tree2"/>
104+ <field eval="2" name="priority"/>
105+ <field name="arch" type="xml">
106+ <field name="user_id" invisible="context.get('user_invisible', False)" position="after">
107+ <field name="project_department_id" invisible="1"/>
108+ </field>
109+ </field>
110+ </record>
111+
112+
113 </data>
114 </openerp>
115

Subscribers

People subscribed via source and target branches