[REM] project: removal of warn_manager and warn_customer features that are now handled by the chatter
bzr revid: qdp-launchpad@openerp.com-20120615125918-zaiickzw4yuudqkj
This commit is contained in:
parent
03b3be3500
commit
bde7606b5b
|
@ -188,8 +188,6 @@ class project(osv.osv):
|
|||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of Projects."),
|
||||
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', help="Link this project to an analytic account if you need financial management on projects. It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc.", ondelete="cascade", required=True),
|
||||
'priority': fields.integer('Sequence', help="Gives the sequence order when displaying the list of projects"),
|
||||
'warn_manager': fields.boolean('Notify Manager', help="If you check this field, the project manager will receive an email each time a task is completed by his team.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
|
||||
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members',
|
||||
help="Project's members are users who can have an access to the tasks related to this project.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'tasks': fields.one2many('project.task', 'project_id', "Task Activities"),
|
||||
|
@ -214,9 +212,6 @@ class project(osv.osv):
|
|||
'project.task': (_get_projects_from_tasks, ['planned_hours', 'remaining_hours', 'work_ids', 'state'], 20),
|
||||
}),
|
||||
'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ),
|
||||
'warn_customer': fields.boolean('Warn Partner', help="If you check this, the user will have a popup when closing a task that propose a message to send by email to the customer.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
|
||||
'task_count': fields.function(_task_count, type='integer', string="Open Tasks"),
|
||||
'color': fields.integer('Color Index'),
|
||||
|
@ -914,28 +909,12 @@ class task(base_stage, osv.osv):
|
|||
return True
|
||||
|
||||
def action_close(self, cr, uid, ids, context=None):
|
||||
""" This action closes the task, then opens the wizard to send an
|
||||
email to the partner or the project manager.
|
||||
""" This action closes the task
|
||||
"""
|
||||
task_id = len(ids) and ids[0] or False
|
||||
self._check_child_task(cr, uid, ids, context=context)
|
||||
if not task_id: return False
|
||||
task = self.browse(cr, uid, task_id, context=context)
|
||||
project = task.project_id
|
||||
res = self.do_close(cr, uid, [task_id], context=context)
|
||||
if project.warn_manager or project.warn_customer:
|
||||
return {
|
||||
'name': _('Send Email after close task'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'mail.compose.message',
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
'nodestroy': True,
|
||||
'context': {'active_id': task.id,
|
||||
'active_model': 'project.task'}
|
||||
}
|
||||
return res
|
||||
return self.do_close(cr, uid, [task_id], context=context)
|
||||
|
||||
def do_close(self, cr, uid, ids, context=None):
|
||||
""" Compatibility when changing to case_close. """
|
||||
|
|
|
@ -286,14 +286,12 @@
|
|||
|
||||
|
||||
<record id="project_project_9" model="project.project">
|
||||
<field name="warn_manager">1</field>
|
||||
<field name="name">OpenERP Integration</field>
|
||||
<field name="parent_id" ref="all_projects_account"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field eval="[(6, 0, [ref('project_tt_specification'),ref('project_tt_development'),ref('project_tt_testing'),ref('project_tt_merge')])]" name="type_ids"/>
|
||||
</record>
|
||||
<record id="project_project_21" model="project.project">
|
||||
<field name="warn_manager">1</field>
|
||||
<field name="priority">10</field>
|
||||
<field name="parent_id" ref="all_projects_account"/>
|
||||
<field name="name">Study + Prototype</field>
|
||||
|
|
|
@ -84,31 +84,19 @@
|
|||
</field>
|
||||
</page>
|
||||
<page string="Administration">
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="4" string="Performance"/>
|
||||
<group string="Administration">
|
||||
<field name="planned_hours" widget="float_time"/>
|
||||
<field name="effective_hours" widget="float_time" />
|
||||
<field name="resource_calendar_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col="2" colspan="2" name="misc">
|
||||
<separator colspan="4" string="Miscellaneous"/>
|
||||
<group string="Miscellaneous" name="misc">
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection" required="1"/>
|
||||
<field name="warn_manager"/>
|
||||
<field name="priority"/>
|
||||
<field name="active" attrs="{'invisible':[('state','in',['open', 'pending', 'template'])]}"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Billing" groups="account.group_account_invoice">
|
||||
<field name="warn_customer"/>
|
||||
<field name="currency_id" select="1" groups="base.group_multi_company" required="1"/>
|
||||
<newline/>
|
||||
<group colspan="4" col="4">
|
||||
<separator colspan="2" string="Mail Header"/>
|
||||
<separator colspan="2" string="Mail Footer"/>
|
||||
<field name="warn_header" nolabel="1" colspan="2"/>
|
||||
<field name="warn_footer" nolabel="1" colspan="2"/>
|
||||
</group>
|
||||
<group col="3">
|
||||
<b>
|
||||
<label string="Variables you can use for headers and footer." colspan="3"/>
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
.oe_btn_width {
|
||||
width: 110px;
|
||||
}
|
||||
.oe_kanban_project {
|
||||
width: 300px;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import mail_compose_message
|
||||
import project_task_delegate
|
||||
import project_task_reevaluate
|
||||
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv
|
||||
from osv import fields
|
||||
from tools.translate import _
|
||||
|
||||
class mail_compose_message(osv.osv_memory):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
def get_value(self, cr, uid, model, resource_id, context=None):
|
||||
'''
|
||||
To get values of the resource_id for the model
|
||||
@param model: Object
|
||||
@param resource_id: id of a record for which values to be read
|
||||
|
||||
@return: Returns a dictionary
|
||||
'''
|
||||
result = super(mail_compose_message, self).get_value(cr, uid, model, resource_id, context=context)
|
||||
if model == 'project.task' and resource_id:
|
||||
task_pool = self.pool.get('project.task')
|
||||
task_data = task_pool.browse(cr, uid, resource_id, context=context)
|
||||
partner = task_data.partner_id or task_data.project_id.partner_id
|
||||
if task_data.project_id.warn_manager and (not task_data.project_id.user_id or task_data.project_id.user_id and not task_data.project_id.user_id.user_email) :
|
||||
raise osv.except_osv(_('Error'), _("Please specify the Project Manager or email address of Project Manager."))
|
||||
elif task_data.project_id.warn_customer and (not partner or (partner and not partner.email)):
|
||||
raise osv.except_osv(_('Error'), _("Please specify the Customer or email address of Customer."))
|
||||
|
||||
result.update({'email_from': task_data.user_id and task_data.user_id.user_email or False})
|
||||
val = {
|
||||
'name': task_data.name,
|
||||
'user_id': task_data.user_id.name,
|
||||
'task_id': "%d/%d" % (task_data.project_id.id, task_data.id),
|
||||
'date_start': task_data.date_start,
|
||||
'date': task_data.date_end,
|
||||
'state': task_data.state
|
||||
}
|
||||
header = (task_data.project_id.warn_header or '') % val
|
||||
footer = (task_data.project_id.warn_footer or '') % val
|
||||
description = u'%s\n %s\n %s\n\n \n%s' % (header, task_data.description or '', footer, task_data.user_id and task_data.user_id.signature)
|
||||
if partner :
|
||||
result.update({'email_to': result.get('email_to',False) and result.get('email_to') + ',' + partner.email})
|
||||
result.update({
|
||||
'body_text': description or False,
|
||||
'email_to': task_data.project_id.user_id and task_data.project_id.user_id.user_email or False,
|
||||
'subject': _("Task '%s' Closed") % task_data.name,
|
||||
'model': model,
|
||||
'res_id': resource_id,
|
||||
})
|
||||
|
||||
return result
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
Loading…
Reference in New Issue