diff --git a/project_issue_extension/__init__.py b/project_issue_extension/__init__.py new file mode 100644 index 0000000..10ef421 --- /dev/null +++ b/project_issue_extension/__init__.py @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Project Issue Extension module for OpenERP +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from . import project diff --git a/project_issue_extension/__openerp__.py b/project_issue_extension/__openerp__.py new file mode 100644 index 0000000..f7c8f3f --- /dev/null +++ b/project_issue_extension/__openerp__.py @@ -0,0 +1,52 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Project Issue Extension module for OpenERP +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + + +{ + 'name': 'Project Issue Extension', + 'version': '0.1', + 'category': 'Project Management', + 'license': 'AGPL-3', + 'summary': 'Better usability for Project Issues', + 'description': """ +Project Issue Extension +======================= + +This module adds 3 fields on project issues : + +* a *Number* field, attached to a sequence (replaces the "ID"), + +* a *Target Resolution Date* (datetime), + +* a *Related Products* fields (many2many). + +Please contact Alexis de Lattre from Akretion for any help or question about this module. + """, + 'author': 'Akretion', + 'website': 'http://www.akretion.com', + 'depends': ['project_issue'], + 'data': [ + 'project_view.xml', + 'project_data.xml', + ], + 'active': False, +} diff --git a/project_issue_extension/project.py b/project_issue_extension/project.py new file mode 100644 index 0000000..6961452 --- /dev/null +++ b/project_issue_extension/project.py @@ -0,0 +1,65 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# Project Issue Extension module for OpenERP +# Copyright (C) 2014 Akretion (http://www.akretion.com) +# @author Alexis de Lattre +# +# 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 . +# +############################################################################## + +from openerp.osv import orm, fields + + +class project_issue(orm.Model): + _inherit = 'project.issue' + + def name_get(self, cr, uid, ids, context=None): + res = [] + if isinstance(ids, (int, long)): + ids = [ids] + for record in self.browse(cr, uid, ids, context=context): + res.append((record.id, u'[%s] %s' % (record.number, record.name))) + return res + + _columns = { + 'number': fields.char('Number', size=32), + 'create_date': fields.datetime('Creation Date', readonly=True), + 'target_date': fields.datetime('Target Resolution Date'), + 'product_ids': fields.many2many( + 'product.product', string="Related Products"), + } + + _defaults = { + 'number': lambda self, cr, uid, context: + self.pool['ir.sequence'].next_by_code( + cr, uid, 'project.issue', context=context), + } + + _sql_constraints = [( + 'number_company_uniq', + 'unique(number, company_id)', + 'An issue with the same number already exists for this company !' + )] + + def copy(self, cr, uid, id, default=None, context=None): + if default is None: + default = {} + default.update({ + 'number': self.pool['ir.sequence'].next_by_code( + cr, uid, 'project.issue', context=context), + }) + return super(project_issue, self).copy( + cr, uid, id, default=default, context=context) diff --git a/project_issue_extension/project_data.xml b/project_issue_extension/project_data.xml new file mode 100644 index 0000000..f7f4f5c --- /dev/null +++ b/project_issue_extension/project_data.xml @@ -0,0 +1,27 @@ + + + + + + + + + Project Issue + project.issue + + + + Project Issue + project.issue + + 4 + 1 + + + + + diff --git a/project_issue_extension/project_view.xml b/project_issue_extension/project_view.xml new file mode 100644 index 0000000..c597a47 --- /dev/null +++ b/project_issue_extension/project_view.xml @@ -0,0 +1,55 @@ + + + + + + + + + usability.project_issue_form + project.issue + + + + True + + + + + + + + + + + + + + usability.project_issue_tree + project.issue + + + + + + + + + + usability.project_issue_search + project.issue + + + + + + + + + + +