Port projct_issue_extension to v8
This commit is contained in:
@@ -1,23 +1,3 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- coding: 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
|
from . import project
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
|||||||
'data': [
|
'data': [
|
||||||
'project_view.xml',
|
'project_view.xml',
|
||||||
'project_data.xml',
|
'project_data.xml',
|
||||||
'partner_view.xml',
|
|
||||||
],
|
],
|
||||||
'active': False,
|
'active': False,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
<?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="view_partner_form" model="ir.ui.view">
|
|
||||||
<field name="name">add.link.to.issues.partner.form</field>
|
|
||||||
<field name="model">res.partner</field>
|
|
||||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<xpath expr="//div[@name='buttons']" position="inside">
|
|
||||||
<button type="action"
|
|
||||||
string="Issues"
|
|
||||||
name="%(project_issue.act_project_project_2_project_issue_all)d"
|
|
||||||
context="{'search_default_partner_id': active_id}"/>
|
|
||||||
</xpath>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</data>
|
|
||||||
</openerp>
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
# Project Issue Extension module for OpenERP
|
# Project Issue Extension module for Odoo
|
||||||
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
# Copyright (C) 2014-2015 Akretion (http://www.akretion.com)
|
||||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
@@ -20,47 +20,36 @@
|
|||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from openerp.osv import orm, fields
|
from openerp import models, fields, api
|
||||||
|
|
||||||
|
|
||||||
class project_issue(orm.Model):
|
class ProjectIssue(models.Model):
|
||||||
_inherit = 'project.issue'
|
_inherit = 'project.issue'
|
||||||
|
_rec_name = 'display_name'
|
||||||
|
|
||||||
def name_get(self, cr, uid, ids, context=None):
|
@api.multi
|
||||||
res = []
|
@api.depends('number', 'name')
|
||||||
if isinstance(ids, (int, long)):
|
def compute_display_name(self):
|
||||||
ids = [ids]
|
for issue in self:
|
||||||
for record in self.browse(cr, uid, ids, context=context):
|
issue.display_name = u'[%s] %s' % (issue.number, issue.name)
|
||||||
res.append((record.id, u'[%s] %s' % (record.number, record.name)))
|
|
||||||
return res
|
|
||||||
|
|
||||||
_columns = {
|
number = fields.Char(string='Number', copy=False, default='/')
|
||||||
'number': fields.char('Number', size=32),
|
display_name = fields.Char(
|
||||||
'create_date': fields.datetime('Creation Date', readonly=True),
|
compute='compute_display_name', string='Display Name', store=True)
|
||||||
'target_date': fields.datetime('Target Resolution Date',
|
target_date = fields.Datetime(
|
||||||
track_visibility='onchange'),
|
string='Target Resolution Date', track_visibility='onchange')
|
||||||
'product_ids': fields.many2many(
|
product_ids = fields.Many2many(
|
||||||
'product.product', string="Related Products"),
|
'product.product', string="Related Products")
|
||||||
}
|
|
||||||
|
|
||||||
_defaults = {
|
@api.model
|
||||||
'number': lambda self, cr, uid, context:
|
def create(self, vals):
|
||||||
self.pool['ir.sequence'].next_by_code(
|
if vals.get('number', '/'):
|
||||||
cr, uid, 'project.issue', context=context),
|
vals['number'] = self.env['ir.sequence'].next_by_code(
|
||||||
}
|
'project.issue')
|
||||||
|
return super(ProjectIssue, self).create(vals)
|
||||||
|
|
||||||
_sql_constraints = [(
|
_sql_constraints = [(
|
||||||
'number_company_uniq',
|
'number_company_uniq',
|
||||||
'unique(number, company_id)',
|
'unique(number, company_id)',
|
||||||
'An issue with the same number already exists for this company !'
|
'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)
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2014 Akretion (http://www.akretion.com/)
|
Copyright (C) 2014-2015 Akretion (http://www.akretion.com/)
|
||||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||||
The licence is in the file __openerp__.py
|
The licence is in the file __openerp__.py
|
||||||
-->
|
-->
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<field name="create_date"/>
|
<field name="create_date"/>
|
||||||
<field name="target_date"/>
|
<field name="target_date"/>
|
||||||
</field>
|
</field>
|
||||||
<xpath expr="//sheet/group/group[@groups='base.group_user']" position="inside">
|
<xpath expr="//button[@name='case_escalate']/.." position="after">
|
||||||
<field name="product_ids" widget="many2many_tags"/>
|
<field name="product_ids" widget="many2many_tags"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
@@ -33,7 +33,10 @@
|
|||||||
<field name="model">project.issue</field>
|
<field name="model">project.issue</field>
|
||||||
<field name="inherit_id" ref="project_issue.project_issue_tree_view"/>
|
<field name="inherit_id" ref="project_issue.project_issue_tree_view"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="id" position="replace">
|
<field name="id" position="attributes">
|
||||||
|
<attribute name="invisible">1</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="id" position="after">
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
@@ -44,7 +47,10 @@
|
|||||||
<field name="model">project.issue</field>
|
<field name="model">project.issue</field>
|
||||||
<field name="inherit_id" ref="project_issue.view_project_issue_filter"/>
|
<field name="inherit_id" ref="project_issue.view_project_issue_filter"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="id" position="replace">
|
<field name="id" position="attributes">
|
||||||
|
<attribute name="invisible">1</attribute>
|
||||||
|
</field>
|
||||||
|
<field name="id" position="after">
|
||||||
<field name="number"/>
|
<field name="number"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
Reference in New Issue
Block a user