[IMP]crm:make stages clickable for statusbar with stage

bzr revid: sgo@tinyerp.com-20120719095505-m9tgj782pln74j4r
This commit is contained in:
Sanjay Gohel (Open ERP) 2012-07-19 15:25:05 +05:30
parent a017b3fa36
commit c5bbcb4705
3 changed files with 15 additions and 21 deletions

View File

@ -289,9 +289,21 @@ class crm_lead(base_stage, osv.osv):
if not stage_id:
return {'value':{}}
stage = self.pool.get('crm.case.stage').browse(cr, uid, stage_id, context)
if stage.state == "draft":
return {'value':{'probability': 0.0}}
if stage.state == "open":
cases = self.browse(cr, uid, ids, context=context)
data = {'active': True}
for case in cases:
if case.stage_id and case.stage_id.state == 'draft':
data['date_open'] = fields.datetime.now()
if not case.user_id:
data['user_id'] = uid
return {'value':data}
if not stage.on_change:
return {'value':{}}
return {'value':{'probability': stage.probability}}
else:
return {'value':{'probability': stage.probability}}
def _check(self, cr, uid, ids=False, context=None):
""" Override of the base.stage method.

View File

@ -432,26 +432,18 @@
<field name="arch" type="xml">
<form string="Opportunities" version="7.0">
<header>
<button name="stage_previous" string="Previous" type="object"
states="open" icon="gtk-go-back" context="{'stage_type': 'opportunity'}"/>
<button name="stage_next" string="Next" type="object"
states="open" icon="gtk-go-forward" context="{'stage_type': 'opportunity'}"/>
<button name="case_mark_won" string="Mark Won" type="object"
states="open" class="oe_highlight"/>
<button name="case_mark_won" string="Mark Won" type="object"
states="draft,pending"/>
<button name="case_open" string="Open" type="object" class="oe_highlight"
states="draft,pending"/>
<button name="case_escalate" string="Escalate" type="object"
states="open" />
<button name="case_mark_lost" string="Mark Lost" type="object"
states="draft,open"/>
<button name="case_reset" string="Reset to Draft" type="object"
states="done,cancel" />
<button name="case_cancel" string="Cancel" type="object"
states="draft"/>
<field name="stage_id" widget="statusbar"
on_change="onchange_stage_id(stage_id)"/>
on_change="onchange_stage_id(stage_id)" clickable="1"/>
</header>
<sheet>
<div class="oe_right oe_button_box">

View File

@ -107,19 +107,9 @@
<header>
<button name="%(action_hr_recruitment_hired_employee)d" string="Hire" type="action"
states="open,pending" class="oe_highlight"/>
<button name="case_open" string="Open" type="object"
states="draft,pending" class="oe_highlight"/>
<button name="case_pending" string="Pending" type="object"
states="open"/>
<button name="case_reset" string="Reset to New" type="object"
states="done,cancel"/>
<button name="case_cancel" string="Refuse" type="object"
states="draft,open,pending" class="oe_highlight"/>
<button name="stage_previous" string="Previous" type="object"
states="open" icon="gtk-go-back"/>
<button name="stage_next" string="Next" type="object"
states="open" icon="gtk-go-forward"/>
<field name="stage_id" widget="statusbar"/>
<field name="stage_id" widget="statusbar" clickable="true"/>
</header>
<sheet>
<div class="oe_right oe_button_box">