[IMP]: crm: Improvement in Lead to Partner and phonecall to partner wizard
bzr revid: ksa@tinyerp.co.in-20100318112349-w1nlurgxhcl6p7j8
This commit is contained in:
parent
3be0ab4baa
commit
03fedcaab9
|
@ -45,9 +45,9 @@ class crm_claim_report(osv.osv):
|
|||
|
||||
def init(self, cr):
|
||||
|
||||
"""
|
||||
""" Display Number of cases And Section Name
|
||||
@param cr: the current row, from the database cursor,
|
||||
Display Number of cases And Section Name """
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_claim_report')
|
||||
cr.execute("""
|
||||
|
|
|
@ -45,8 +45,9 @@ class crm_fundraising_report(osv.osv):
|
|||
|
||||
def init(self, cr):
|
||||
|
||||
""" @param cr: the current row, from the database cursor
|
||||
Display Number of cases and Average Probability """
|
||||
""" Display Number of cases and Average Probability
|
||||
@param cr: the current row, from the database cursor
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_fundraising_report')
|
||||
cr.execute("""
|
||||
|
|
|
@ -42,8 +42,10 @@ class crm_helpdesk_report(osv.osv):
|
|||
|
||||
def init(self, cr):
|
||||
|
||||
"""@param cr: the current row, from the database cursor
|
||||
Display Deadline ,Responsible user, partner ,Department """
|
||||
"""
|
||||
Display Deadline ,Responsible user, partner ,Department
|
||||
@param cr: the current row, from the database cursor
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_helpdesk_report')
|
||||
cr.execute("""
|
||||
|
|
|
@ -42,8 +42,10 @@ class crm_lead_report(osv.osv):
|
|||
}
|
||||
def init(self, cr):
|
||||
|
||||
""" @param cr: the current row, from the database cursor
|
||||
CRM Lead Report"""
|
||||
"""
|
||||
CRM Lead Report
|
||||
@param cr: the current row, from the database cursor
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_lead_report')
|
||||
cr.execute("""
|
||||
|
|
|
@ -48,8 +48,9 @@ class crm_opportunity_report(osv.osv):
|
|||
|
||||
def init(self, cr):
|
||||
|
||||
""" @param cr: the current row, from the database cursor
|
||||
Display Est.Revenue , Average Probability ,Est.Revenue Probabilit """
|
||||
""" Display Est.Revenue , Average Probability ,Est.Revenue Probability
|
||||
@param cr: the current row, from the database cursor
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_opportunity_report')
|
||||
cr.execute("""
|
||||
|
|
|
@ -41,8 +41,9 @@ class crm_phonecall_report(osv.osv):
|
|||
|
||||
def init(self, cr):
|
||||
|
||||
""" @param cr: the current row, from the database cursor,
|
||||
Phone Calls By User And Section """
|
||||
""" Phone Calls By User And Section
|
||||
@param cr: the current row, from the database cursor,
|
||||
"""
|
||||
|
||||
tools.drop_view_if_exists(cr, 'crm_phonecall_report')
|
||||
cr.execute("""
|
||||
|
|
|
@ -55,7 +55,7 @@ class crm_lead2opportunity(osv.osv_memory):
|
|||
lead_obj = self.pool.get('crm.lead')
|
||||
opp_obj = self. pool.get('crm.opportunity')
|
||||
data_obj = self.pool.get('ir.model.data')
|
||||
|
||||
|
||||
# Get Opportunity views
|
||||
result = data_obj._get_id(cr, uid, 'crm', 'view_crm_case_opportunities_filter')
|
||||
res = data_obj.read(cr, uid, result, ['res_id'])
|
||||
|
@ -65,56 +65,56 @@ class crm_lead2opportunity(osv.osv_memory):
|
|||
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
|
||||
if id3:
|
||||
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
|
||||
|
||||
|
||||
lead = lead_obj.browse(cr, uid, record_id, context=context)
|
||||
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
new_opportunity_id = opp_obj.create(cr, uid, {
|
||||
'name': this.name,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': lead.partner_id and lead.partner_id.id or False ,
|
||||
'section_id': lead.section_id and lead.section_id.id or False,
|
||||
'description': lead.description or False,
|
||||
'date_deadline': lead.date_deadline or False,
|
||||
'name': this.name,
|
||||
'planned_revenue': this.planned_revenue,
|
||||
'probability': this.probability,
|
||||
'partner_id': lead.partner_id and lead.partner_id.id or False ,
|
||||
'section_id': lead.section_id and lead.section_id.id or False,
|
||||
'description': lead.description or False,
|
||||
'date_deadline': lead.date_deadline or False,
|
||||
'partner_address_id': lead.partner_address_id and \
|
||||
lead.partner_address_id.id or False ,
|
||||
'priority': lead.priority,
|
||||
'phone': lead.phone,
|
||||
lead.partner_address_id.id or False ,
|
||||
'priority': lead.priority,
|
||||
'phone': lead.phone,
|
||||
'email_from': lead.email_from
|
||||
})
|
||||
|
||||
|
||||
new_opportunity = opp_obj.browse(cr, uid, new_opportunity_id)
|
||||
vals = {
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
'partner_id': this.partner_id and this.partner_id.id or False,
|
||||
}
|
||||
if not lead.opportunity_id:
|
||||
vals.update({'opportunity_id' : new_opportunity.id})
|
||||
|
||||
|
||||
lead_obj.write(cr, uid, [lead.id], vals)
|
||||
lead_obj.case_close(cr, uid, [lead.id])
|
||||
opp_obj.case_open(cr, uid, [new_opportunity_id])
|
||||
|
||||
value = {
|
||||
'name': _('Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.opportunity',
|
||||
'res_id': int(new_opportunity_id),
|
||||
'view_id': False,
|
||||
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _('Opportunity'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'crm.opportunity',
|
||||
'res_id': int(new_opportunity_id),
|
||||
'view_id': False,
|
||||
'views': [(id2, 'form'), (id3, 'tree'), (False, 'calendar'), (False, 'graph')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'search_view_id': res['res_id']
|
||||
}
|
||||
return value
|
||||
|
||||
_columns = {
|
||||
'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
|
||||
'probability': fields.float('Success Probability'),
|
||||
'planned_revenue': fields.float('Expected Revenue'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
'name' : fields.char('Opportunity Summary', size=64, required=True, select=1),
|
||||
'probability': fields.float('Success Probability'),
|
||||
'planned_revenue': fields.float('Expected Revenue'),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner'),
|
||||
}
|
||||
|
||||
|
||||
def view_init(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function checks for precondition before wizard executes
|
||||
|
@ -148,9 +148,10 @@ Leads Could not convert into Opportunity"))
|
|||
@return : default values of fields.
|
||||
"""
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
data = context and context.get('active_ids', []) or []
|
||||
res = super(crm_lead2opportunity, self).default_get(cr, uid, fields, context=context)
|
||||
|
||||
for lead in lead_obj.browse(cr, uid, context.get('active_ids', [])):
|
||||
for lead in lead_obj.browse(cr, uid, data, []):
|
||||
if 'name' in fields:
|
||||
res.update({'name': lead.partner_name})
|
||||
if 'partner_id' in fields:
|
||||
|
|
|
@ -52,7 +52,6 @@ class crm_phonecall2partner(osv.osv_memory):
|
|||
raise osv.except_osv(_('Warning !'),
|
||||
_('A partner is already defined on this phonecall.'))
|
||||
|
||||
|
||||
def _select_partner(self, cr, uid, context=None):
|
||||
"""
|
||||
This function Searches for Partner from selected phonecall.
|
||||
|
|
Loading…
Reference in New Issue