[IMP] project : string rename to Contact and traceback of escalate button

bzr revid: rpr@tinyerp.com-20120726045804-g8kn4cx01klawdr6
This commit is contained in:
Rajesh Prajapati (OpenERP) 2012-07-26 10:28:04 +05:30
parent 61f361bfee
commit 968a0de2e0
2 changed files with 31 additions and 7 deletions

View File

@ -19,7 +19,7 @@
#
##############################################################################
from osv import fields
from osv import fields, osv
from tools.translate import _
class base_state(object):
@ -104,7 +104,23 @@ class base_state(object):
self.case_set(cr, uid, [case.id], 'open', values, context=context)
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
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.user_id, 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)
@ -169,7 +185,15 @@ class base_state(object):
msg = _('%s has been <b>opened</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
def case_close_send_note(self, cr, uid, ids, context=None):
for id in ids:
msg = _('%s has been <b>closed</b>.') % (self.case_get_note_msg_prefix(cr, uid, id, context=context))

View File

@ -10,7 +10,7 @@
<menuitem id="menu_project_management" name="Project" parent="base.menu_main_pm" sequence="1"/>
<menuitem id="base.menu_definitions" name="Configuration" parent="base.menu_main_pm" sequence="60"/>
<act_window
context="{'search_default_project_id': [active_id], 'default_project_id': active_id}"
id="act_project_project_2_project_task_all"
@ -19,7 +19,7 @@
src_model="project.project"
view_mode="kanban,tree,form,calendar,graph"
view_type="form"/>
<!-- Project Read/Unread actions -->
<record id="actions_server_project_unread" model="ir.actions.server">
<field name="name">Mark unread</field>
@ -84,7 +84,7 @@
<group>
<group>
<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="analytic_account_id" invisible="1" required="0"/>
</group>
@ -195,7 +195,7 @@
<field name="date" invisible="1"/>
<field name="name" string="Project Name"/>
<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="planned_hours" widget="float_time"/>
<field name="total_hours" widget="float_time"/>