[REF] crm: Reverted the changes of on change method. Historize only when 'Next' and 'Previous' buttons are clicked.
bzr revid: uco@tinyerp.com-20101101123059-7z0kpnrz5rkvzon1
This commit is contained in:
parent
0d7d21462c
commit
e1ddb581a3
|
@ -201,7 +201,7 @@ class crm_case(object):
|
|||
if stage.on_change:
|
||||
data.update({'probability': stage.probability})
|
||||
self.write(cr, uid, [case.id], data, context=context)
|
||||
return True
|
||||
return prev_stage
|
||||
|
||||
def onchange_partner_id(self, cr, uid, ids, part, email=False):
|
||||
"""This function returns value of partner address based on partner
|
||||
|
|
|
@ -286,7 +286,13 @@ class crm_lead(crm_case, osv.osv):
|
|||
stage = super(crm_lead, self).stage_next(cr, uid, ids, context)
|
||||
if stage:
|
||||
stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage, context=context)
|
||||
self.onchange_stage_id(cr, uid, ids, stage)
|
||||
self.history(cr, uid, ids, _('Stage'), details=stage_obj.name)
|
||||
for case in self.browse(cr, uid, ids):
|
||||
if case.type == 'lead':
|
||||
message = _("The stage of lead '%s' has been changed to '%s'.") % (case.name, case.stage_id.name)
|
||||
elif case.type == 'opportunity':
|
||||
message = _("The stage of opportunity '%s' has been changed to '%s'.") % (case.name, case.stage_id.name)
|
||||
self.log(cr, uid, case.id, message)
|
||||
if stage_obj.on_change:
|
||||
data = {'probability': stage_obj.probability}
|
||||
self.write(cr, uid, ids, data)
|
||||
|
@ -295,8 +301,14 @@ class crm_lead(crm_case, osv.osv):
|
|||
def stage_previous(self, cr, uid, ids, context=None):
|
||||
stage = super(crm_lead, self).stage_previous(cr, uid, ids, context)
|
||||
if stage:
|
||||
stage_obj = self.pool.get('crm.case.stage').browse(cr, uid, stage, context=context)
|
||||
self.history(cr, uid, ids, _('Stage'), details=stage_obj.name)
|
||||
for case in self.browse(cr, uid, ids):
|
||||
self.onchange_stage_id(cr, uid, [case.id], case.stage_id.id)
|
||||
if case.type == 'lead':
|
||||
message = _("The stage of lead '%s' has been changed to '%s'.") % (case.name, case.stage_id.name)
|
||||
elif case.type == 'opportunity':
|
||||
message = _("The stage of opportunity '%s' has been changed to '%s'.") % (case.name, case.stage_id.name)
|
||||
self.log(cr, uid, case.id, message)
|
||||
return stage
|
||||
|
||||
def message_new(self, cr, uid, msg, context):
|
||||
|
|
|
@ -57,8 +57,7 @@
|
|||
<newline />
|
||||
<field name="section_id" widget="selection" />
|
||||
<field name="user_id" />
|
||||
<field name="stage_id" domain="[('object_id.model', '=', 'crm.lead'), ('section_ids', '=', section_id)]"
|
||||
on_change="onchange_stage_id(stage_id)"/>
|
||||
<field name="stage_id" domain="[('object_id.model', '=', 'crm.lead'), ('section_ids', '=', section_id)]"/>
|
||||
<group col="2" colspan="1">
|
||||
<button name="stage_previous" string=""
|
||||
states="open,pending,draft" type="object"
|
||||
|
|
|
@ -146,13 +146,6 @@ class crm_opportunity(osv.osv):
|
|||
return {'value':{}}
|
||||
|
||||
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
|
||||
self.history(cr, uid, ids, _('Stage'), details=stage.name)
|
||||
for case in self.browse(cr, uid, ids):
|
||||
if case.type == 'lead':
|
||||
message = _("The stage of lead '%s' has been changed to '%s'.") % (case.name, case.stage_id.name)
|
||||
elif case.type == 'opportunity':
|
||||
message = _("The stage of opportunity '%s' has been changed to '%s'.") % (case.name, case.stage_id.name)
|
||||
self.log(cr, uid, case.id, message)
|
||||
|
||||
if not stage.on_change:
|
||||
return {'value':{}}
|
||||
|
|
Loading…
Reference in New Issue