diff --git a/addons/crm/report/crm_claim_report.py b/addons/crm/report/crm_claim_report.py index 23cb7f65c56..03e439d889e 100644 --- a/addons/crm/report/crm_claim_report.py +++ b/addons/crm/report/crm_claim_report.py @@ -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(""" diff --git a/addons/crm/report/crm_fundraising_report.py b/addons/crm/report/crm_fundraising_report.py index fd0c884fc8d..d0ff60a4055 100644 --- a/addons/crm/report/crm_fundraising_report.py +++ b/addons/crm/report/crm_fundraising_report.py @@ -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(""" diff --git a/addons/crm/report/crm_helpdesk_report.py b/addons/crm/report/crm_helpdesk_report.py index 7694352f523..9884b7cd584 100644 --- a/addons/crm/report/crm_helpdesk_report.py +++ b/addons/crm/report/crm_helpdesk_report.py @@ -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(""" diff --git a/addons/crm/report/crm_lead_report.py b/addons/crm/report/crm_lead_report.py index 02b3c3a018e..6c092f4f984 100644 --- a/addons/crm/report/crm_lead_report.py +++ b/addons/crm/report/crm_lead_report.py @@ -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(""" diff --git a/addons/crm/report/crm_opportunity_report.py b/addons/crm/report/crm_opportunity_report.py index 1f07d2ff1eb..db3a7e65d24 100644 --- a/addons/crm/report/crm_opportunity_report.py +++ b/addons/crm/report/crm_opportunity_report.py @@ -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(""" diff --git a/addons/crm/report/crm_phonecall_report.py b/addons/crm/report/crm_phonecall_report.py index 6e5dc5cdd42..a72bfbd9c1f 100644 --- a/addons/crm/report/crm_phonecall_report.py +++ b/addons/crm/report/crm_phonecall_report.py @@ -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(""" diff --git a/addons/crm/wizard/crm_lead_to_opportunity.py b/addons/crm/wizard/crm_lead_to_opportunity.py index 181be829897..6191f02d2fa 100644 --- a/addons/crm/wizard/crm_lead_to_opportunity.py +++ b/addons/crm/wizard/crm_lead_to_opportunity.py @@ -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: diff --git a/addons/crm/wizard/crm_phonecall_to_partner.py b/addons/crm/wizard/crm_phonecall_to_partner.py index 00bd1993c94..5dbef42b50f 100644 --- a/addons/crm/wizard/crm_phonecall_to_partner.py +++ b/addons/crm/wizard/crm_phonecall_to_partner.py @@ -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.