[FIX] crm : stage well assign according to the sales team if there is one, or according all stage if no sales team

bzr revid: tfr@openerp.com-20110125101505-08sisemudvj7xsi2
This commit is contained in:
Thibault Francois 2011-01-25 11:15:05 +01:00
parent cf5462b933
commit 5a20b4cf7b
2 changed files with 8 additions and 4 deletions

View File

@ -124,11 +124,13 @@
<form string="Stage">
<separator string="Stage Definition" colspan="4"/>
<field name="name" select="1"/>
<field name="type" invisible="1" />
<field name="type" groups="base.group_extended" />
<field name="sequence"/>
<field name="probability"/>
<field name="on_change"/>
<group colspan="4" col="2" >
<field name="on_change"/>
</group>
<separator string="Requirements" colspan="4"/>
<field name="requirements" nolabel="1" colspan="4"/>
<field name="section_ids" invisible="1" />

View File

@ -70,8 +70,10 @@ class crm_lead2opportunity(osv.osv_memory):
cr, uid, opportunity_view_tree, context=context).res_id
lead = leads.browse(cr, uid, record_id, context=context)
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1)])
if(lead.section_id):
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1), ('section_ids','=', lead.section_id.id)])
else:
stage_ids = self.pool.get('crm.case.stage').search(cr, uid, [('type','=','opportunity'),('sequence','>=',1)])
for this in self.browse(cr, uid, ids, context=context):
vals ={
'planned_revenue': this.planned_revenue,