X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=addons%2Fcrm%2Fcrm_lead.py;h=a5315ab3a529b1316efd2fab85b51880e51b7b1e;hb=0c36f8a4cecebe22c7d37a9cc3920910cde35fc9;hp=27a84c442b9d10be3106ced7b7eb8c3aceb113dc;hpb=6a01718aef7bddf70e836b211938d85c29d8efec;p=odoo%2Fodoo.git diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 27a84c4..a5315ab 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -153,6 +153,11 @@ class crm_lead(format_address, osv.osv): return result, fold def fields_view_get(self, cr, user, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + if view_type == 'form' and context and context.get('opportunity_id'): + # TODO: replace by get_formview_action call + lead_type = self.browse(cr, user, context['opportunity_id'], context=context).type + view_lead_xml_id = 'crm_case_form_view_oppor' if lead_type == 'opportunity' else 'crm_case_form_view_leads' + _, view_id = self.pool['ir.model.data'].get_object_reference(cr, user, 'crm', view_lead_xml_id) res = super(crm_lead, self).fields_view_get(cr, user, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type == 'form': res['arch'] = self.fields_view_get_address(cr, user, res['arch'], context=context) @@ -241,10 +246,10 @@ class crm_lead(format_address, osv.osv): 'opt_out': fields.boolean('Opt-Out', oldname='optout', help="If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign. " "Filter 'Available for Mass Mailing' allows users to filter the leads when performing mass mailing."), - 'type':fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', help="Type is used to separate Leads and Opportunities"), + 'type': fields.selection([ ('lead','Lead'), ('opportunity','Opportunity'), ],'Type', select=True, help="Type is used to separate Leads and Opportunities"), 'priority': fields.selection(crm.AVAILABLE_PRIORITIES, 'Priority', select=True), 'date_closed': fields.datetime('Closed', readonly=True), - 'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility='onchange', + 'stage_id': fields.many2one('crm.case.stage', 'Stage', track_visibility='onchange', select=True, domain="['&', ('section_ids', '=', section_id), '|', ('type', '=', type), ('type', '=', 'both')]"), 'user_id': fields.many2one('res.users', 'Salesperson', select=True, track_visibility='onchange'), 'referred': fields.char('Referred By', size=64),