[FIX] modified with the remarks of apr
bzr revid: jem@openerp.com-20140219111251-a06rz7uw83iodp4d
This commit is contained in:
parent
41a4d00abe
commit
e799c68264
|
@ -9,16 +9,23 @@ class crm_lead_to_project_issue_wizard(osv.TransientModel):
|
||||||
wizards = self.browse(cr, uid, ids, context=context)
|
wizards = self.browse(cr, uid, ids, context=context)
|
||||||
Lead = self.pool["crm.lead"]
|
Lead = self.pool["crm.lead"]
|
||||||
Issue = self.pool["project.issue"]
|
Issue = self.pool["project.issue"]
|
||||||
|
|
||||||
for wizard in wizards:
|
for wizard in wizards:
|
||||||
# get the lead to transform
|
# get the lead to transform
|
||||||
lead = wizard.lead_id
|
lead = wizard.lead_id
|
||||||
|
|
||||||
|
partner = self._find_matching_partner(cr, uid, context=context)
|
||||||
|
if not partner and (lead.partner_name or lead.contact_name):
|
||||||
|
partner_ids = Lead.handle_partner_assignation(cr, uid, [lead.id], context=context)
|
||||||
|
partner = partner_ids[lead.id]
|
||||||
|
|
||||||
# create new project.issue
|
# create new project.issue
|
||||||
vals = {"name": lead.name,
|
vals = {"name": lead.name,
|
||||||
"description": lead.description,
|
"description": lead.description,
|
||||||
"email_from": lead.email_from,
|
"email_from": lead.email_from,
|
||||||
"partner_id": lead.partner_id.id,
|
"project_id": wizard.project_id.id,
|
||||||
"project_id": wizard.project_id.id
|
"partner_id" : partner,
|
||||||
|
"user_id" : None
|
||||||
}
|
}
|
||||||
issue_id = Issue.create(cr, uid, vals, context=None)
|
issue_id = Issue.create(cr, uid, vals, context=None)
|
||||||
# move the mail thread
|
# move the mail thread
|
||||||
|
@ -40,7 +47,7 @@ class crm_lead_to_project_issue_wizard(osv.TransientModel):
|
||||||
|
|
||||||
|
|
||||||
_name = "crm.lead2projectissue.wizard"
|
_name = "crm.lead2projectissue.wizard"
|
||||||
|
_inherit = 'crm.partner.binding'
|
||||||
_columns = {
|
_columns = {
|
||||||
"lead_id" : fields.many2one("crm.lead","Lead", domain=[("type","=","lead")]),
|
"lead_id" : fields.many2one("crm.lead","Lead", domain=[("type","=","lead")]),
|
||||||
"project_id" : fields.many2one("project.project", "Project", domain=[("use_issues","=",True)])
|
"project_id" : fields.many2one("project.project", "Project", domain=[("use_issues","=",True)])
|
||||||
|
|
|
@ -20,8 +20,9 @@
|
||||||
<label for="project_id" />
|
<label for="project_id" />
|
||||||
<field name="project_id" />
|
<field name="project_id" />
|
||||||
<footer>
|
<footer>
|
||||||
<button type="special" special="cancel" string="Cancel" />
|
<button type="object" name="action_lead_to_project_issue" string="Create Issue" class="oe_highlight"/>
|
||||||
<button type="object" name="action_lead_to_project_issue" string="Convert" />
|
or
|
||||||
|
<button string="Cancel" class="oe_link" special="cancel"/>
|
||||||
</footer>
|
</footer>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
@ -33,7 +34,7 @@
|
||||||
<field name="model">crm.lead</field>
|
<field name="model">crm.lead</field>
|
||||||
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
|
<field name="inherit_id" ref="crm.crm_case_form_view_leads" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='stage_id']" position="before">
|
<xpath expr="//div[@name='buttons']/button" position="after">
|
||||||
<button name="%(convert_lead2projectissue_wizard_action)d" string="Convert to Issue" type="action" help="Convert to Issue" />
|
<button name="%(convert_lead2projectissue_wizard_action)d" string="Convert to Issue" type="action" help="Convert to Issue" />
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|
Loading…
Reference in New Issue