CRM Case escalation

bzr revid: fp@tinyerp.com-873fb63736fef0de95b5773dcb67b93de5136768
This commit is contained in:
Fabien Pinckaers 2007-04-12 13:40:49 +00:00
parent f8503096f8
commit ad0fbe32ce
2 changed files with 18 additions and 5 deletions

View File

@ -151,8 +151,8 @@ class crm_case_rule(osv.osv):
'active': fields.boolean('Active'),
'sequence': fields.integer('Sequence'),
'trg_state_from': fields.selection([('','')]+AVAILABLE_STATES, 'Case state from', size=16),
'trg_state_to': fields.selection([('','')]+AVAILABLE_STATES, 'Case state to', size=16),
'trg_state_from': fields.selection([('',''),('escalate','Escalate')]+AVAILABLE_STATES, 'Case state from', size=16),
'trg_state_to': fields.selection([('',''),('escalate','Escalate')]+AVAILABLE_STATES, 'Case state to', size=16),
'trg_date_type': fields.selection([
('none','None'),
@ -260,8 +260,6 @@ class crm_case(osv.osv):
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
_order = 'priority, date_deadline, id'
def _action(self, cr, uid, cases, state_to, scrit=[], context={}):
action_ids = self.pool.get('crm.case.rule').search(cr, uid, scrit)
level = MAX_LEVEL
@ -485,6 +483,20 @@ class crm_case(osv.osv):
self._action(cr,uid, cases, 'done')
return True
def case_escalate(self, cr, uid, ids, *args):
cases = self.browse(cr, uid, ids)
for case in cases:
data = {'active':True, 'user_id': False}
if case.section_id.parent_id:
data['section_id'] = case.section_id.parent_id.id
else:
raise osv.except_osv('Error !', 'You can not escalate this case.\nYou are already at the top level.')
self.write(cr, uid, ids, data)
self.__history(cr, uid, cases, 'escalate')
self._action(cr, uid, cases, 'escalate')
return True
def case_open(self, cr, uid, ids, *args):
cases = self.browse(cr, uid, ids)
self.__log(cr, uid, cases, 'open')

View File

@ -260,11 +260,12 @@
</group>
<field name="state" select="1"/>
<group col="5" colspan="2">
<group col="6" colspan="2">
<button name="case_close" string="Close" states="open,draft,pending" type="object"/>
<button name="case_open" string="Open" states="draft,pending" type="object"/>
<button name="case_cancel" string="Cancel" states="draft,open,pending" type="object"/>
<button name="case_pending" string="Pending" states="draft,open" type="object"/>
<button name="case_escalate" string="Escalate" states="open,draft,pending" type="object"/>
<button name="case_reset" string="Reset to Draft" states="done,cancel" type="object"/>
</group>
</page><page string="References">