[MERGE] lp:~openerp-dev/openobject-addons/trunk-addons_issue2_project-rpr
bzr revid: stw@openerp.com-20120808140424-gop7xnjpjj993pt8
This commit is contained in:
commit
7b6ca2cbfd
|
@ -19,7 +19,7 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
from osv import fields
|
from osv import fields, osv
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
|
|
||||||
class base_state(object):
|
class base_state(object):
|
||||||
|
@ -92,6 +92,24 @@ class base_state(object):
|
||||||
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
|
data.update(self.onchange_partner_address_id(cr, uid, ids, addr['contact'])['value'])
|
||||||
return {'value': data}
|
return {'value': data}
|
||||||
|
|
||||||
|
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
|
||||||
|
data = {'active': True}
|
||||||
|
for case in cases:
|
||||||
|
parent_id = case.section_id.parent_id
|
||||||
|
if parent_id:
|
||||||
|
data['section_id'] = parent_id.id
|
||||||
|
if parent_id.change_responsible and parent_id.user_id:
|
||||||
|
data['user_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(parent_id, context=context)
|
||||||
|
self._action(cr, uid, cases, 'escalate', context=context)
|
||||||
|
return True
|
||||||
|
|
||||||
def case_open(self, cr, uid, ids, context=None):
|
def case_open(self, cr, uid, ids, context=None):
|
||||||
""" Opens case """
|
""" Opens case """
|
||||||
cases = self.browse(cr, uid, ids, context=context)
|
cases = self.browse(cr, uid, ids, context=context)
|
||||||
|
@ -170,6 +188,15 @@ class base_state(object):
|
||||||
self.message_append_note(cr, uid, [id], body=msg, context=context)
|
self.message_append_note(cr, uid, [id], body=msg, context=context)
|
||||||
return True
|
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
|
||||||
|
|
||||||
def case_close_send_note(self, cr, uid, ids, context=None):
|
def case_close_send_note(self, cr, uid, ids, context=None):
|
||||||
for id in ids:
|
for id in ids:
|
||||||
msg = _('%s has been <b>closed</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
|
msg = _('%s has been <b>closed</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
|
<field name="user_id" string="Project Manager" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
|
||||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
|
<field name="partner_id" string = "Contact" on_change="onchange_partner_id(partner_id)"/>
|
||||||
<field name="privacy_visibility"/>
|
<field name="privacy_visibility"/>
|
||||||
<field name="analytic_account_id" invisible="1" required="0"/>
|
<field name="analytic_account_id" invisible="1" required="0"/>
|
||||||
</group>
|
</group>
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
<field name="date" invisible="1"/>
|
<field name="date" invisible="1"/>
|
||||||
<field name="name" string="Project Name"/>
|
<field name="name" string="Project Name"/>
|
||||||
<field name="user_id" string="Project Manager"/>
|
<field name="user_id" string="Project Manager"/>
|
||||||
<field name="partner_id" string="Partner"/>
|
<field name="partner_id" string="Contact"/>
|
||||||
<field name="parent_id" string="Parent" invisible="1"/>
|
<field name="parent_id" string="Parent" invisible="1"/>
|
||||||
<field name="planned_hours" widget="float_time"/>
|
<field name="planned_hours" widget="float_time"/>
|
||||||
<field name="total_hours" widget="float_time"/>
|
<field name="total_hours" widget="float_time"/>
|
||||||
|
|
Loading…
Reference in New Issue