openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #01406
[Merge] lp:~dreis-pt/project-service/7.0-project_categ-dr into lp:project-service
Daniel Reis has proposed merging lp:~dreis-pt/project-service/7.0-project_categ-dr into lp:project-service.
Requested reviews:
Project Core Editors (project-core-editors)
For more details, see:
https://code.launchpad.net/~dreis-pt/project-service/7.0-project_categ-dr/+merge/195384
Add modules to allow for Project specific Tags/Categories.
--
https://code.launchpad.net/~dreis-pt/project-service/7.0-project_categ-dr/+merge/195384
Your team Project Core Editors is requested to review the proposed merge of lp:~dreis-pt/project-service/7.0-project_categ-dr into lp:project-service.
=== removed directory 'crm_categ_hierarchy'
=== removed file 'crm_categ_hierarchy/__init__.py'
--- crm_categ_hierarchy/__init__.py 2012-11-22 13:26:40 +0000
+++ crm_categ_hierarchy/__init__.py 1970-01-01 00:00:00 +0000
@@ -1,3 +0,0 @@
-# -*- coding: utf-8 -*-
-import crm_categ
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== removed file 'crm_categ_hierarchy/__openerp__.py'
--- crm_categ_hierarchy/__openerp__.py 2013-03-04 16:16:31 +0000
+++ crm_categ_hierarchy/__openerp__.py 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (C) 2012 Daniel Reis
-#
-# 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/>.
-#
-##############################################################################
-{
- 'name': 'Category hierarchical structure',
- 'version': '1.0',
- "category": "Customer Relationship Management",
- 'description': """Add a tree-like structure to CRM categories""",
- 'author': 'Daniel Reis',
- 'website': 'daniel.reis@xxxxxxxxxxxx',
- 'depends': ['crm'],
- 'update_xml': ['crm_categ_view.xml'],
- 'installable': False,
- 'application': False,
-}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== removed file 'crm_categ_hierarchy/crm_categ.py'
--- crm_categ_hierarchy/crm_categ.py 2012-12-20 11:00:54 +0000
+++ crm_categ_hierarchy/crm_categ.py 1970-01-01 00:00:00 +0000
@@ -1,53 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (C) 2012 Daniel Reis
-#
-# 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 osv import fields, osv
-
-class crm_case_categ(osv.osv):
- _inherit = "crm.case.categ"
- _order = 'parent_id, name'
-
- def name_get(self, cr, uid, ids, context=None):
- res = []
- for row in self.read(cr, uid, ids, ['name','parent_id'], context=context):
- parent = row['parent_id'] and (row['parent_id'][1]+' / ') or ''
- res.append((row['id'], parent + row['name']))
- return res
-
- def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
- res = self.name_get(cr, uid, ids, context=context)
- return dict(res)
-
- _columns = {
- 'note': fields.text('Description', size=64),
- 'parent_id': fields.many2one('crm.case.categ', 'Parent'),
- 'child_ids': fields.many2many('crm.case.categ', 'crm_case_categ_parent_rel', 'parent_id', 'categ_id', 'Child Categories'),
- 'complete_name': fields.function(_name_get_fnc, method=True, type="char", string='Name'),
- 'code': fields.char('Code', size=10),
- }
- _constraints = [
- (osv.osv._check_recursion, 'Error! Cannot create recursive cycle.', ['parent_id'])
- ]
-
-crm_case_categ()
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
-
=== removed file 'crm_categ_hierarchy/crm_categ_view.xml'
--- crm_categ_hierarchy/crm_categ_view.xml 2012-12-20 11:00:54 +0000
+++ crm_categ_hierarchy/crm_categ_view.xml 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
- <data>
-
- <!-- crm.case.category form -->
- <record id="crm_case_categ-view_dreis" model="ir.ui.view">
- <field name="name">crm.case.categ.form.dreis</field>
- <field name="model">crm.case.categ</field>
- <field name="inherit_id" ref="crm.crm_case_categ-view"/>
- <field name="arch" type="xml">
- <field name="section_id" position="after">
- <field name="parent_id"/>
- <field name="code"/>
- <field name="note" colspan="4"/>
- </field>
- </field>
- </record>
-
- <!-- crm.case.category tree (replacement) -->
- <record id="crm_case_categ_tree-view_dreis" model="ir.ui.view">
- <field name="name">crm.case.categ.tree.dreis</field>
- <field name="model">crm.case.categ</field>
- <field name="type">tree</field>
- <field name="field_parent">child_ids</field>
- <field name="arch" type="xml">
- <tree string="Case Category">
- <field name="complete_name"/>
- <field name="parent_id"/>
- <field name="section_id"/>
- </tree>
- </field>
- </record>
-
- </data>
-</openerp>
-
-
-
-
=== added directory 'project_categ'
=== added file 'project_categ/__init__.py'
--- project_categ/__init__.py 1970-01-01 00:00:00 +0000
+++ project_categ/__init__.py 2013-11-15 13:13:44 +0000
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import project_categ_model
=== added file 'project_categ/__openerp__.py'
--- project_categ/__openerp__.py 1970-01-01 00:00:00 +0000
+++ project_categ/__openerp__.py 2013-11-15 13:13:44 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2013 Daniel Reis
+#
+# 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/>.
+#
+##############################################################################
+{
+ 'name': 'Per Project Configurable Categories',
+ 'summary': 'Projects can have an allowed category list',
+ 'version': '0.1',
+ "category": "Project Management",
+ 'description': """\
+To use:
+ 1. Create a parent Category (Tag). E.g. "System Type".
+ 2. Create categories to be made available as child. E.g. "Computer", "Printer", ...
+ 3. On the Project form, Other Info tab, set the "Root Category".
+
+Now, Tasks for that Project will require you to set a Tag and it will only
+be selectable from the Project's list.
+""",
+ 'author': 'Daniel Reis',
+ 'depends': [
+ 'project',
+ ],
+ 'data': [
+ 'project_categ_view.xml',
+ ],
+ 'installable': True,
+ 'application': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_categ/project_categ_model.py'
--- project_categ/project_categ_model.py 1970-01-01 00:00:00 +0000
+++ project_categ/project_categ_model.py 2013-11-15 13:13:44 +0000
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2013 Daniel Reis
+#
+# 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 ProjectProject(orm.Model):
+ _inherit = 'project.project'
+ _columns = {
+ 'task_categ_id': fields.many2one(
+ 'project.category', 'Root Category for Tasks'),
+ }
+
+
+class ProjectCategory(orm.Model):
+ _inherit = 'project.category'
+
+ def _name_get(self, cr, uid, ids, context=None):
+ res = []
+ rows = self.read(cr, uid, ids, ['name', 'parent_id'], context=context)
+ for row in rows:
+ parent = row['parent_id'] and (row['parent_id'][1]+' / ') or ''
+ res.append((row['id'], parent + row['name']))
+ return res
+
+ def _name_get_fnc(self, cr, uid, ids, prop, unknow_none, context=None):
+ return dict(self._name_get(cr, uid, ids, context=context))
+
+ _columns = {
+ 'parent_id': fields.many2one(
+ 'project.category', 'Parent Category', select=True),
+ 'child_ids': fields.one2many(
+ 'project.category', 'parent_id', 'Child Categories'),
+ 'complete_name': fields.function(
+ _name_get_fnc, method=True, type='char', string='Name'),
+ 'code': fields.char('Code', size=10),
+ }
+ _order = 'parent_id,name'
+
+
+class ProjectTask(orm.Model):
+ _inherit = 'project.task'
+
+ def onchange_project(self, cr, uid, id, project_id, context=None):
+ # on_change is necessary to populate fields on create, before saving
+ try:
+ res = super(ProjectTask, self).onchange_project(
+ cr, uid, id, project_id, context) or {}
+ except AttributeError:
+ res = {}
+
+ if project_id:
+ obj = self.pool.get('project.project').browse(
+ cr, uid, project_id, context=context)
+ if obj.task_categ_id:
+ res.setdefault('value', {})
+ res['value']['task_categ_id'] = obj.task_categ_id.id
+ return res
+
+ _columns = {
+ 'task_categ_id': fields.related(
+ 'project_id', 'task_categ_id', string="Category Root",
+ type='many2one', relation='project.category', readonly=True),
+ 'categ_ids': fields.many2many(
+ 'project.category', string='Tags',
+ domain="[('id','child_of',task_categ_id)"
+ ",('id','!=',task_categ_id)]"),
+ }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_categ/project_categ_view.xml'
--- project_categ/project_categ_view.xml 1970-01-01 00:00:00 +0000
+++ project_categ/project_categ_view.xml 2013-11-15 13:13:44 +0000
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <!-- Project Tags (Categories) form -->
+ <record id="project_category_form_view_categs" model="ir.ui.view">
+ <field name="name">project_category_form_view_sdesk</field>
+ <field name="model">project.category</field>
+ <field name="inherit_id" ref="project.project_category_form_view"/>
+ <field name="arch" type="xml">
+ <field name="name" position="after">
+ <newline/>
+ <field name="parent_id"/>
+ <newline/>
+ <field name="child_ids" context="{'default_parent_id': active_id}"/>
+ </field>
+ </field>
+ </record>
+
+ <!-- Project form -->
+ <record id="project_form_view_categs" model="ir.ui.view">
+ <field name="name">project_form_view_categs</field>
+ <field name="model">project.project</field>
+ <field name="inherit_id" ref="project.edit_project"/>
+ <field name="arch" type="xml">
+ <field name="parent_id" position="after">
+ <field name="task_categ_id" domain="[('child_ids','!=',False)]"/>
+ </field>
+ </field>
+ </record>
+
+ <!-- Project Task form -->
+ <record id="project_task_form_view_categs" model="ir.ui.view">
+ <field name="name">project_task_form_view_categs</field>
+ <field name="model">project.task</field>
+ <field name="inherit_id" ref="project.view_task_form2"/>
+ <field name="arch" type="xml">
+
+ <field name="project_id" position="attributes">
+ <attribute name="on_change">onchange_project(project_id)</attribute>
+ </field>
+
+ <field name="project_id" position="after">
+ <field name="task_categ_id" invisible="1"/>
+ </field>
+
+ <field name="categ_ids" position="attributes">
+ <attribute name="attrs">{'required':[('task_categ_id','!=',False)]}</attribute>
+ </field>
+
+ </field>
+ </record>
+
+ </data>
+</openerp>
=== added directory 'project_categ_issue'
=== added file 'project_categ_issue/__init__.py'
--- project_categ_issue/__init__.py 1970-01-01 00:00:00 +0000
+++ project_categ_issue/__init__.py 2013-11-15 13:13:44 +0000
@@ -0,0 +1,2 @@
+# -*- coding: utf-8 -*-
+import project_categ_model
=== added file 'project_categ_issue/__openerp__.py'
--- project_categ_issue/__openerp__.py 1970-01-01 00:00:00 +0000
+++ project_categ_issue/__openerp__.py 2013-11-15 13:13:44 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2013 Daniel Reis
+#
+# 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/>.
+#
+##############################################################################
+{
+ 'name': 'Per Project Configurable Categorie on Issues',
+ 'summary': 'Projects Issues can have an allowed category list',
+ 'version': '0.1',
+ "category": "Project Management",
+ 'description': """\
+Adds to Issues the ability to limit selectable Categories to a Proeject's
+specific list.
+""",
+ 'author': 'Daniel Reis',
+ 'depends': [
+ 'project_issue',
+ 'project_categ',
+ ],
+ 'data': [
+ 'project_categ_view.xml',
+ ],
+ 'installable': True,
+ 'auto_install': True,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_categ_issue/project_categ_model.py'
--- project_categ_issue/project_categ_model.py 1970-01-01 00:00:00 +0000
+++ project_categ_issue/project_categ_model.py 2013-11-15 13:13:44 +0000
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2013 Daniel Reis
+#
+# 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 ProjectProject(orm.Model):
+ _inherit = 'project.project'
+ _columns = {
+ 'issue_categ_id': fields.many2one(
+ 'project.category', 'Root Category for Issues'),
+ }
+
+
+class ProjectIssue(orm.Model):
+ _inherit = 'project.issue'
+
+ def onchange_project(self, cr, uid, id, project_id, context=None):
+ # on_change is necessary to populate fields on create, before saving
+ try:
+ res = super(ProjectIssue, self).onchange_project(
+ cr, uid, id, project_id, context) or {}
+ except AttributeError:
+ res = {}
+
+ if project_id:
+ obj = self.pool.get('project.project').browse(
+ cr, uid, project_id, context=context)
+ if obj.issue_categ_id:
+ res.setdefault('value', {})
+ res['value']['issue_categ_id'] = obj.issue_categ_id.id
+ return res
+
+ _columns = {
+ 'issue_categ_id': fields.related(
+ 'project_id', 'issue_categ_id', string="Category Root",
+ type='many2one', relation='project.category', readonly=True),
+ 'categ_ids': fields.many2many(
+ 'project.category', string='Tags',
+ domain="[('id','child_of',issue_categ_id)"
+ ",('id','!=',issue_categ_id)]"),
+ }
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'project_categ_issue/project_categ_view.xml'
--- project_categ_issue/project_categ_view.xml 1970-01-01 00:00:00 +0000
+++ project_categ_issue/project_categ_view.xml 2013-11-15 13:13:44 +0000
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <!-- Project form -->
+ <record id="project_form_view_categs" model="ir.ui.view">
+ <field name="name">project_form_view_categs</field>
+ <field name="model">project.project</field>
+ <field name="inherit_id" ref="project.edit_project"/>
+ <field name="arch" type="xml">
+ <field name="parent_id" position="after">
+ <field name="issue_categ_id" domain="[('child_ids','!=',False)]"/>
+ </field>
+ </field>
+ </record>
+
+ <!-- Project Issue form -->
+ <record id="project_issue_form_view_categs" model="ir.ui.view">
+ <field name="name">project_issue_form_view_categs</field>
+ <field name="model">project.issue</field>
+ <field name="inherit_id" ref="project_issue.project_issue_form_view"/>
+ <field name="arch" type="xml">
+
+ <field name="project_id" position="attributes">
+ <attribute name="on_change">onchange_project(project_id)</attribute>
+ </field>
+
+ <field name="project_id" position="after">
+ <field name="issue_categ_id" invisible="1"/>
+ </field>
+
+ <field name="categ_ids" position="attributes">
+ <attribute name="attrs">{'required':[('issue_categ_id','!=',False)]}</attribute>
+ </field>
+
+ </field>
+ </record>
+
+ </data>
+</openerp>
+