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

Subscribers

People subscribed via source and target branches