[WIP] rename 'lead2partner' into 'generate.partner' for more clarity
bzr revid: abo@openerp.com-20121112133033-urh3emybeabfvdxm
This commit is contained in:
parent
ffbb5bacbd
commit
3b2b5f31b9
|
@ -97,7 +97,6 @@ Dashboard for CRM will include:
|
||||||
'board_crm_view.xml',
|
'board_crm_view.xml',
|
||||||
|
|
||||||
'res_config_view.xml',
|
'res_config_view.xml',
|
||||||
|
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
'crm_demo.xml',
|
'crm_demo.xml',
|
||||||
|
|
|
@ -13,13 +13,13 @@
|
||||||
-
|
-
|
||||||
I fill in a lead2partner wizard.
|
I fill in a lead2partner wizard.
|
||||||
-
|
-
|
||||||
!record {model: crm.lead2partner, id: crm_lead2partner_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_4")]}'}:
|
!record {model: crm.generate.partner, id: crm_generate_partner_id1, context: '{"active_model": "crm.lead", "active_ids": [ref("crm_case_4")]}'}:
|
||||||
-
|
-
|
||||||
I create a partner from the lead2partner wizard.
|
I create a partner from the lead2partner wizard.
|
||||||
-
|
-
|
||||||
!python {model: crm.lead2partner}: |
|
!python {model: crm.generate.partner}: |
|
||||||
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_4')], 'active_id': ref('crm_case_4')})
|
context.update({'active_model': 'crm.lead', 'active_ids': [ref('crm_case_4')], 'active_id': ref('crm_case_4')})
|
||||||
self.make_partner(cr, uid ,[ref("crm_lead2partner_id1")], context=context)
|
self.make_partner(cr, uid ,[ref("crm_generate_partner_id1")], context=context)
|
||||||
-
|
-
|
||||||
I convert lead into opportunity for exiting customer.
|
I convert lead into opportunity for exiting customer.
|
||||||
-
|
-
|
||||||
|
|
|
@ -19,13 +19,12 @@
|
||||||
#
|
#
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|
||||||
import crm_lead_to_partner
|
import crm_generate_partner
|
||||||
import crm_lead_to_opportunity
|
|
||||||
import crm_phonecall_to_phonecall
|
import crm_phonecall_to_phonecall
|
||||||
import crm_opportunity_to_phonecall
|
import crm_opportunity_to_phonecall
|
||||||
|
import crm_lead_to_opportunity
|
||||||
import crm_partner_to_opportunity
|
import crm_partner_to_opportunity
|
||||||
import crm_phonecall_to_opportunity
|
import crm_phonecall_to_opportunity
|
||||||
import crm_merge_opportunities
|
import crm_merge_opportunities
|
||||||
|
|
||||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
||||||
|
|
|
@ -22,9 +22,15 @@
|
||||||
from osv import osv, fields
|
from osv import osv, fields
|
||||||
from tools.translate import _
|
from tools.translate import _
|
||||||
|
|
||||||
class crm_lead2partner(osv.osv_memory):
|
class crm_generate_partner(osv.osv_memory):
|
||||||
_name = 'crm.lead2partner'
|
"""
|
||||||
_description = 'Generate a partner from a CRM item (lead, phonecall, ...) either by explicitly converting the element to a partner, either by triggering an action that will create a partner (e.g. convert a lead into an opportunity).'
|
Handle the partner generation from any CRM item (lead, phonecall, ...)
|
||||||
|
either by explicitly converting the element to a partner, either by
|
||||||
|
triggering an action that will create a partner (e.g. convert a lead into
|
||||||
|
an opportunity).
|
||||||
|
"""
|
||||||
|
_name = 'crm.generate.partner'
|
||||||
|
_description = 'Generate a partner from a CRM item.'
|
||||||
_columns = {
|
_columns = {
|
||||||
'action': fields.selection([
|
'action': fields.selection([
|
||||||
('exist', 'Link to an existing customer'),
|
('exist', 'Link to an existing customer'),
|
||||||
|
@ -36,7 +42,8 @@ class crm_lead2partner(osv.osv_memory):
|
||||||
|
|
||||||
def _find_matching_partner(self, cr, uid, context=None):
|
def _find_matching_partner(self, cr, uid, context=None):
|
||||||
"""
|
"""
|
||||||
Try to find a matching partner regarding the active model data, like the customer's name, email, phone number, etc.
|
Try to find a matching partner regarding the active model data, like
|
||||||
|
the customer's name, email, phone number, etc.
|
||||||
@return partner_id if any, False otherwise
|
@return partner_id if any, False otherwise
|
||||||
"""
|
"""
|
||||||
if context is None:
|
if context is None:
|
||||||
|
@ -67,7 +74,7 @@ class crm_lead2partner(osv.osv_memory):
|
||||||
return partner_id
|
return partner_id
|
||||||
|
|
||||||
def default_get(self, cr, uid, fields, context=None):
|
def default_get(self, cr, uid, fields, context=None):
|
||||||
res = super(crm_lead2partner, self).default_get(cr, uid, fields, context=context)
|
res = super(crm_generate_partner, self).default_get(cr, uid, fields, context=context)
|
||||||
partner_id = self._find_matching_partner(cr, uid, context=context)
|
partner_id = self._find_matching_partner(cr, uid, context=context)
|
||||||
|
|
||||||
if 'action' in fields:
|
if 'action' in fields:
|
|
@ -27,7 +27,7 @@ import re
|
||||||
class crm_lead2opportunity_partner(osv.osv_memory):
|
class crm_lead2opportunity_partner(osv.osv_memory):
|
||||||
_name = 'crm.lead2opportunity.partner'
|
_name = 'crm.lead2opportunity.partner'
|
||||||
_description = 'Lead To Opportunity Partner'
|
_description = 'Lead To Opportunity Partner'
|
||||||
_inherit = 'crm.lead2partner'
|
_inherit = 'crm.generate.partner'
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.selection([
|
'name': fields.selection([
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<field name="model">crm.lead2opportunity.partner</field>
|
<field name="model">crm.lead2opportunity.partner</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Convert to Opportunity" version="7.0">
|
<form string="Convert to Opportunity" version="7.0">
|
||||||
<group>
|
<group name="name">
|
||||||
<field name="name" class="oe_inline"/>
|
<field name="name" class="oe_inline"/>
|
||||||
<field name="opportunity_ids" attrs="{'invisible': [('name', '!=', 'merge')]}">
|
<field name="opportunity_ids" attrs="{'invisible': [('name', '!=', 'merge')]}">
|
||||||
<tree>
|
<tree>
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</group>
|
</group>
|
||||||
<group attrs="{'invisible': [('name', '!=', 'convert')]}">
|
<group name="action" attrs="{'invisible': [('name', '!=', 'convert')]}">
|
||||||
<field name="action" class="oe_inline"/>
|
<field name="action" class="oe_inline"/>
|
||||||
<field name="partner_id"
|
<field name="partner_id"
|
||||||
attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"
|
attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"
|
||||||
|
|
Loading…
Reference in New Issue