[FIX] partner and adress creation (by stw) + add send email button
bzr revid: tfr@openerp.com-20110222162403-1y8jaec31mp05d50
This commit is contained in:
committed by
Thibault Francois
parent
0811ebc782
commit
a966a3a593
@@ -13,8 +13,8 @@
|
||||
<field name="context">{'type':'lead'}</field>
|
||||
<field name="help">Add specific stages to leads and opportunities allowing your sales to better organise their sales pipeline. Stages will allow them to easily track how a specific lead or opportunity is positioned in the sales cycle.</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<menuitem action="crm_lead_stage_act" id="menu_crm_lead_stage_act" name="Lead stages"
|
||||
groups="base.group_extended" sequence="0"
|
||||
@@ -90,7 +90,10 @@
|
||||
</group>
|
||||
<group colspan="2" col="3">
|
||||
<separator string="Communication" colspan="4" col="3"/>
|
||||
<field name="email_from" widget="email"/>
|
||||
<field name="email_from" widget="email"/><button string="Send Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="terp-mail-message-new" type="action" colspan="1"/>
|
||||
<newline/>
|
||||
<field name="phone"/>
|
||||
<newline/>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="crm_opportunity_stage_act" model="ir.actions.act_window">
|
||||
<field name="name">Stages</field>
|
||||
<field name="res_model">crm.case.stage</field>
|
||||
@@ -11,13 +11,13 @@
|
||||
<field name="context">{'type':'opportunity'}</field>
|
||||
<field name="help">Create specific stages that will help your sales better organise their sales pipeline by maintaining them to their sales opportunities. It will allow them to easily track how is positioned a specific opportunity in the sales cycle.</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
<menuitem action="crm_opportunity_stage_act" id="menu_crm_opportunity_stage_act" name="Opportunity stages"
|
||||
groups="base.group_extended" sequence="0"
|
||||
parent="base.menu_crm_config_lead" />
|
||||
|
||||
|
||||
<!-- Opportunities Form View -->
|
||||
<record model="ir.ui.view" id="crm_case_form_view_oppor">
|
||||
<field name="name">Opportunities</field>
|
||||
@@ -74,8 +74,15 @@
|
||||
string="Contact"
|
||||
on_change="onchange_partner_address_id(partner_address_id, email_from)"
|
||||
colspan="1" />
|
||||
<field name="email_from" string="Email" />
|
||||
<field name="phone"/>
|
||||
<group col="3" colspan="2">
|
||||
<field name="email_from" string="Email" />
|
||||
<button string="Send Email"
|
||||
name="%(crm.action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="terp-mail-message-new" type="action" />
|
||||
</group>
|
||||
<field name="phone"/>
|
||||
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Categorization"/>
|
||||
@@ -172,7 +179,7 @@
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Details">
|
||||
|
||||
|
||||
<field name="description" colspan="4" nolabel="1"/>
|
||||
<group attrs="{'invisible': [('history', '!=', True)]}">
|
||||
<button colspan="4"
|
||||
@@ -181,7 +188,7 @@
|
||||
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
|
||||
icon="terp-mail-replied" type="action" />
|
||||
</group>
|
||||
|
||||
|
||||
</page>
|
||||
<page string="Attachments">
|
||||
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
|
||||
@@ -380,8 +387,8 @@
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -96,6 +96,10 @@ Leads Could not convert into Opportunity"))
|
||||
|
||||
def _convert(self, cr, uid, ids, lead, partner_id, stage_ids, context=None):
|
||||
leads = self.pool.get('crm.lead')
|
||||
address_id = self.pool.get('res.partner.address').search(cr, uid,
|
||||
[('partner_id', '=', partner_id)],
|
||||
order='create_date desc',
|
||||
limit=1)
|
||||
vals = {
|
||||
'planned_revenue': lead.planned_revenue,
|
||||
'probability': lead.probability,
|
||||
@@ -104,8 +108,11 @@ Leads Could not convert into Opportunity"))
|
||||
'user_id': (lead.user_id and lead.user_id.id),
|
||||
'type': 'opportunity',
|
||||
'stage_id': stage_ids and stage_ids[0] or False,
|
||||
'date_action': time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
'date_action': time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
}
|
||||
if address_id:
|
||||
vals['partner_address_id'] = address_id[0]
|
||||
|
||||
lead.write(vals, context=context)
|
||||
leads.history(cr, uid, [lead], _('Converted to opportunity'), details='Converted to Opportunity', context=context)
|
||||
if lead.partner_id:
|
||||
|
||||
Reference in New Issue
Block a user