Port projct_issue_extension to v8
This commit is contained in:
@@ -1,23 +1,3 @@
|
||||
# -*- 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import project
|
||||
|
||||
@@ -47,7 +47,6 @@ Please contact Alexis de Lattre from Akretion <alexis.delattre@akretion.com> for
|
||||
'data': [
|
||||
'project_view.xml',
|
||||
'project_data.xml',
|
||||
'partner_view.xml',
|
||||
],
|
||||
'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
|
||||
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||
# Project Issue Extension module for Odoo
|
||||
# Copyright (C) 2014-2015 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
|
||||
@@ -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'
|
||||
_rec_name = 'display_name'
|
||||
|
||||
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
|
||||
@api.multi
|
||||
@api.depends('number', 'name')
|
||||
def compute_display_name(self):
|
||||
for issue in self:
|
||||
issue.display_name = u'[%s] %s' % (issue.number, issue.name)
|
||||
|
||||
_columns = {
|
||||
'number': fields.char('Number', size=32),
|
||||
'create_date': fields.datetime('Creation Date', readonly=True),
|
||||
'target_date': fields.datetime('Target Resolution Date',
|
||||
track_visibility='onchange'),
|
||||
'product_ids': fields.many2many(
|
||||
'product.product', string="Related Products"),
|
||||
}
|
||||
number = fields.Char(string='Number', copy=False, default='/')
|
||||
display_name = fields.Char(
|
||||
compute='compute_display_name', string='Display Name', store=True)
|
||||
target_date = fields.Datetime(
|
||||
string='Target Resolution Date', track_visibility='onchange')
|
||||
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),
|
||||
}
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if vals.get('number', '/'):
|
||||
vals['number'] = self.env['ir.sequence'].next_by_code(
|
||||
'project.issue')
|
||||
return super(ProjectIssue, self).create(vals)
|
||||
|
||||
_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)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?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>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
@@ -22,7 +22,7 @@
|
||||
<field name="create_date"/>
|
||||
<field name="target_date"/>
|
||||
</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"/>
|
||||
</xpath>
|
||||
</field>
|
||||
@@ -33,7 +33,10 @@
|
||||
<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="id" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="id" position="after">
|
||||
<field name="number"/>
|
||||
</field>
|
||||
</field>
|
||||
@@ -44,7 +47,10 @@
|
||||
<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="id" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</field>
|
||||
<field name="id" position="after">
|
||||
<field name="number"/>
|
||||
</field>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user