Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1021226-mma into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)
Related bugs:
  Bug #1021226 in OpenERP Addons: "can't escalate Helpdesk Requests"
  https://bugs.launchpad.net/openobject-addons/+bug/1021226

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1021226-mma/+merge/113549

Hello,

        base_status: I have added case_escalate method and notification for fix 
the issue of "can't escalate Help-desk Requests ". Now user can escalate 
help-desk issue to parent team smoothly  

Thanks,
Mayur
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1021226-mma/+merge/113549
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1021226-mma.
=== modified file 'base_status/base_state.py'
--- base_status/base_state.py	2012-05-30 09:11:09 +0000
+++ base_status/base_state.py	2012-07-05 11:09:58 +0000
@@ -19,7 +19,7 @@
 #
 ##############################################################################
 
-from osv import fields
+from osv import fields, osv
 from tools.translate import _
 
 class base_state(object):
@@ -104,6 +104,25 @@
             self.case_open_send_note(cr, uid, [case.id], context=context)
         return True
 
+    def case_escalate(self, cr, uid, ids, context=None):
+        """ Escalates case to parent level """
+        cases = self.browse(cr, uid, ids, context=context)
+        cases[0].state # fill browse record cache, for _action having old and new values
+        for case in cases:
+            data = {'active': True}
+            if case.section_id.parent_id:
+                data['section_id'] = case.section_id.parent_id.id
+                if case.section_id.parent_id.change_responsible:
+                    if case.section_id.parent_id.user_id:
+                        data['user_id'] = case.section_id.parent_id.user_id.id
+            else:
+                raise osv.except_osv(_('Error !'), _('You can not escalate, you are already at the top level regarding your sales-team category.'))
+            self.write(cr, uid, [case.id], data, context=context)
+            case.case_escalate_send_note(case.section_id.parent_id, context=context)
+        cases = self.browse(cr, uid, ids, context=context)
+        self._action(cr, uid, cases, 'escalate', context=context)
+        return True
+
     def case_close(self, cr, uid, ids, context=None):
         """ Closes case """
         self.case_set(cr, uid, ids, 'done', {'date_closed': fields.datetime.now()}, context=context)
@@ -192,3 +211,12 @@
             msg = _('%s has been <b>renewed</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
             self.message_append_note(cr, uid, [id], body=msg, context=context)
         return True
+
+    def case_escalate_send_note(self, cr, uid, ids, new_section=None, context=None):
+        for id in ids:
+            if new_section:
+                msg = '%s has been <b>escalated</b> to <b>%s</b>.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context), new_section.name)
+            else:
+                msg = '%s has been <b>escalated</b>.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
+            self.message_append_note(cr, uid, [id], 'System Notification', msg, context=context)
+        return True

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to