[IMP] Project/Project_issue : Improvements for escalation and working hours to close/open the issue
bzr revid: jvo@tinyerp.com-20100527141854-r66pf1bsihvdas4n
This commit is contained in:
parent
d18c0b82e2
commit
5bfdd355b5
|
@ -135,6 +135,7 @@ class project(osv.osv):
|
|||
'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."),
|
||||
'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."),
|
||||
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages'),
|
||||
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.'),
|
||||
}
|
||||
_order = "sequence"
|
||||
_defaults = {
|
||||
|
@ -149,11 +150,18 @@ class project(osv.osv):
|
|||
if leave['date_start'] > leave['date']:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def _check_escalation(self, cr, uid, ids):
|
||||
project_obj = self.browse(cr, uid, ids[0])
|
||||
if project_obj.project_escalation_id:
|
||||
if project_obj.project_escalation_id.id == project_obj.id:
|
||||
return False
|
||||
return True
|
||||
|
||||
_constraints = [
|
||||
(_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date'])
|
||||
(_check_dates, 'Error! project start-date must be lower then project end-date.', ['date_start', 'date']),
|
||||
(_check_escalation, 'Error! You cannot assign escalation to the same project!', ['project_escalation_id'])
|
||||
]
|
||||
|
||||
def set_template(self, cr, uid, ids, context={}):
|
||||
res = self.setActive(cr, uid, ids, value=False, context=context)
|
||||
return res
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
<separator colspan="2" string="Miscelleanous"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<field name="warn_manager"/>
|
||||
<field name="project_escalation_id"/>
|
||||
</group>
|
||||
|
||||
<newline/>
|
||||
|
|
|
@ -112,16 +112,17 @@ class project_issue(osv.osv, crm.crm_case):
|
|||
_columns = {
|
||||
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
|
||||
'id': fields.integer('ID'),
|
||||
'name': fields.char('Name', size=128, required=True),
|
||||
'create_date': fields.datetime('Creation Date' , readonly=True),
|
||||
'write_date': fields.datetime('Update Date' , readonly=True),
|
||||
'date_deadline': fields.date('Deadline'),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'name': fields.char('Name', size=128, required=True),
|
||||
'active': fields.boolean('Active', required=False),
|
||||
'create_date': fields.datetime('Creation Date' , readonly=True),
|
||||
'write_date': fields.datetime('Update Date' , readonly=True),
|
||||
'date_deadline': fields.date('Deadline'),
|
||||
'date_closed': fields.datetime('Closed', readonly=True),
|
||||
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
|
||||
select=True, help='Sales team to which Case belongs to.\
|
||||
Define Responsible user and Email account for mail gateway.'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'user_id': fields.many2one('res.users', 'Responsible'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'partner_address_id': fields.many2one('res.partner.address', 'Partner Contact', \
|
||||
domain="[('partner_id','=',partner_id)]"),
|
||||
'company_id': fields.many2one('res.company', 'Company'),
|
||||
|
@ -163,6 +164,8 @@ class project_issue(osv.osv, crm.crm_case):
|
|||
'day_close': fields.function(_compute_day, string='Days to Close', \
|
||||
method=True, multi='day_close', type="float", store=True),
|
||||
'assigned_to' : fields.many2one('res.users', 'Assigned to'),
|
||||
'working_hours_open': fields.float('Working Hours to Open the Issue'),
|
||||
'working_hours_close': fields.float('Working Hours to Close the Issue'),
|
||||
}
|
||||
|
||||
def _get_project(self, cr, uid, context):
|
||||
|
@ -172,6 +175,7 @@ class project_issue(osv.osv, crm.crm_case):
|
|||
return False
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a: 1,
|
||||
'user_id': crm.crm_case._get_default_user,
|
||||
'partner_id': crm.crm_case._get_default_partner,
|
||||
'partner_address_id': crm.crm_case._get_default_partner_address,
|
||||
|
@ -260,6 +264,25 @@ class project_issue(osv.osv, crm.crm_case):
|
|||
if not stage.on_change:
|
||||
return {'value':{}}
|
||||
return {'value':{}}
|
||||
|
||||
def case_escalate(self, cr, uid, ids, *args):
|
||||
"""Escalates case to top level
|
||||
@param self: The object pointer
|
||||
@param cr: the current row, from the database cursor,
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param ids: List of case Ids
|
||||
@param *args: Tuple Value for additional Params
|
||||
"""
|
||||
res = super(project_issue, self).case_escalate(cr, uid, ids, args)
|
||||
cases = self.browse(cr, uid, ids)
|
||||
for case in cases:
|
||||
data = {}
|
||||
if case.project_id.project_escalation_id:
|
||||
data['project_id'] = case.project_id.project_escalation_id.id
|
||||
else:
|
||||
raise osv.except_osv(_('Warning !'), _('You cannot escalate this case.\nThe relevant Project has not configured the Escalation Project!'))
|
||||
self.write(cr, uid, [case.id], data)
|
||||
return res
|
||||
|
||||
project_issue()
|
||||
|
||||
|
|
|
@ -82,8 +82,13 @@
|
|||
<separator string="Statistics" colspan="2" col="2"/>
|
||||
<field name="day_open"/>
|
||||
<field name="day_close"/>
|
||||
<field name="working_hours_open" widget="float_time"/>
|
||||
<field name="working_hours_close" widget="float_time"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<separator string="References" colspan="2"/>
|
||||
<field name="id"/>
|
||||
<field name="active"/>
|
||||
</group>
|
||||
<field name="log_ids" nolabel="1" colspan="4">
|
||||
<tree string="Logs">
|
||||
|
|
Loading…
Reference in New Issue