Add module project_issue_extension.

This commit is contained in:
Alexis de Lattre
2014-04-18 18:08:17 +02:00
parent 53b1ff6ed4
commit 037e4d4214
5 changed files with 222 additions and 0 deletions

View File

@@ -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 <alexis.delattre@akretion.com>
#
# 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 . import project

View File

@@ -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 <alexis.delattre@akretion.com>
#
# 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': '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 <alexis.delattre@akretion.com> 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,
}

View File

@@ -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 <alexis.delattre@akretion.com>
#
# 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 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)

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data noupdate="1">
<record id="project_issue_seq_type" model="ir.sequence.type">
<field name="name">Project Issue</field>
<field name="code">project.issue</field>
</record>
<record id="project_issue_seq" model="ir.sequence">
<field name="name">Project Issue</field>
<field name="code">project.issue</field>
<field name="prefix"></field>
<field name="padding">4</field>
<field name="number_next">1</field>
<field name="company_id" eval="False"/>
</record>
</data>
</openerp>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<record id="project_issue_form_view" model="ir.ui.view">
<field name="name">usability.project_issue_form</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="id" position="attributes">
<attribute name="invisible">True</attribute>
</field>
<field name="id" position="after">
<field name="number"/>
<field name="create_date"/>
<field name="target_date"/>
</field>
<xpath expr="//sheet/group/group[@groups='base.group_user']" position="inside">
<field name="product_ids" widget="many2many_tags"/>
</xpath>
</field>
</record>
<record id="project_issue_tree_view" model="ir.ui.view">
<field name="name">usability.project_issue_tree</field>
<field name="model">project.issue</field>
<field name="inherit_id" ref="project_issue.project_issue_tree_view"/>
<field name="arch" type="xml">
<field name="id" position="replace">
<field name="number"/>
</field>
</field>
</record>
<record id="view_project_issue_filter" model="ir.ui.view">
<field name="name">usability.project_issue_search</field>
<field name="model">project.issue</field>
<field name="inherit_id" ref="project_issue.view_project_issue_filter"/>
<field name="arch" type="xml">
<field name="id" position="replace">
<field name="number"/>
</field>
</field>
</record>
</data>
</openerp>