← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/department-mgmt/add-dep-on-project-task-jge into lp:department-mgmt

 

Joël Grand-Guillaume @ camptocamp has proposed merging lp:~camptocamp/department-mgmt/add-dep-on-project-task-jge into lp:department-mgmt.

Requested reviews:
  Department Core Editors (department-core-editors)

For more details, see:
https://code.launchpad.net/~camptocamp/department-mgmt/add-dep-on-project-task-jge/+merge/217068

Hi,

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

Regards,

-- 
https://code.launchpad.net/~camptocamp/department-mgmt/add-dep-on-project-task-jge/+merge/217068
Your team Department Core Editors is requested to review the proposed merge of lp:~camptocamp/department-mgmt/add-dep-on-project-task-jge into lp:department-mgmt.
=== modified file 'project_department/__init__.py'
--- project_department/__init__.py	2013-02-28 12:24:19 +0000
+++ project_department/__init__.py	2014-04-24 14:59:18 +0000
@@ -1,1 +1,1 @@
-#empty
+from . import project
\ No newline at end of file

=== modified file 'project_department/__openerp__.py'
--- project_department/__openerp__.py	2013-02-28 12:24:19 +0000
+++ project_department/__openerp__.py	2014-04-24 14:59:18 +0000
@@ -6,7 +6,7 @@
     "license": "AGPL-3",
     "category": "Generic Modules/Projects & Services",
     "description": """\
-Add Department to Projects and to corresponding tree, search and form  views.
+Add Department to Projects and task to corresponding tree, search and form  views.
 """,
     "website": "http://camptocamp.com";,
     "depends": ["project", "analytic_department"],

=== added file 'project_department/project.py'
--- project_department/project.py	1970-01-01 00:00:00 +0000
+++ project_department/project.py	2014-04-24 14:59:18 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2014 Camptocamp
+#    Author Joel Grand-Guillaume
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import fields, orm
+
+
+class ProjectTask(orm.Model):
+    
+    _inherit = 'project.task'
+    _columns = {
+        'department_id': fields.related(
+                'project_id',
+                'department_id',
+                type='many2one',
+                relation='hr.department',
+                string='Department',
+                store=True,
+                readonly=True),
+    }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== 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-04-24 14:59:18 +0000
@@ -41,6 +41,46 @@
              </field>
          </record>
 
+        <record id="view_task_search_form" model="ir.ui.view">
+            <field name="name">project.task.search.form</field>
+            <field name="model">project.task</field>
+            <field name="inherit_id" ref="project.view_task_search_form"/>
+            <field name="arch" type="xml">
+              <field name="user_id" position="after">
+                <field name="department_id"/>
+              </field>
+              <filter string="Users" name="group_user_id" icon="terp-personal" domain="[]"  context="{'group_by':'user_id'}" position="after">
+                <filter string="Department" name="group_department_id" icon="terp-personal" domain="[]"  context="{'group_by':'department_id'}"/>
+              </filter>
+            </field>
+        </record>
+
+
+        <record id="view_task_form2" model="ir.ui.view">
+            <field name="name">project.task.departement.form</field>
+            <field name="model">project.task</field>
+            <field name="inherit_id" ref="project.view_task_form2"/>
+            <field eval="2" name="priority"/>
+            <field name="arch" type="xml">
+                <field name="user_id" attrs="{'readonly':[('state','in',['done', 'cancelled'])]}" options='{"no_open": True}' position="after">
+                  <field name="department_id" />
+                </field>
+            </field>
+        </record>
+
+        <record id="view_task_tree2" model="ir.ui.view">
+            <field name="name">project.task.department.tree</field>
+            <field name="model">project.task</field>
+            <field name="inherit_id" ref="project.view_task_tree2"/>
+            <field eval="2" name="priority"/>
+            <field name="arch" type="xml">
+                <field name="user_id" invisible="context.get('user_invisible', False)" position="after">
+                  <field name="department_id" invisible="1"/>
+                </field>
+            </field>
+        </record>
+
+
     </data>
 </openerp>
 


Follow ups