[WIP] rename 'lead2partner' into 'generate.partner' for more clarity

bzr revid: abo@openerp.com-20121112133033-urh3emybeabfvdxm
This commit is contained in:
Antonin Bourguignon 2012-11-12 14:30:33 +01:00
parent ffbb5bacbd
commit 3b2b5f31b9
6 changed files with 20 additions and 15 deletions

View File

@ -97,7 +97,6 @@ Dashboard for CRM will include:
'board_crm_view.xml',
'res_config_view.xml',
],
'demo': [
'crm_demo.xml',

View File

@ -13,13 +13,13 @@
-
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.
-
!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')})
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.
-

View File

@ -19,13 +19,12 @@
#
##############################################################################
import crm_lead_to_partner
import crm_lead_to_opportunity
import crm_generate_partner
import crm_phonecall_to_phonecall
import crm_opportunity_to_phonecall
import crm_lead_to_opportunity
import crm_partner_to_opportunity
import crm_phonecall_to_opportunity
import crm_merge_opportunities
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -22,9 +22,15 @@
from osv import osv, fields
from tools.translate import _
class crm_lead2partner(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).'
class crm_generate_partner(osv.osv_memory):
"""
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 = {
'action': fields.selection([
('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):
"""
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
"""
if context is None:
@ -67,7 +74,7 @@ class crm_lead2partner(osv.osv_memory):
return partner_id
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)
if 'action' in fields:

View File

@ -27,7 +27,7 @@ import re
class crm_lead2opportunity_partner(osv.osv_memory):
_name = 'crm.lead2opportunity.partner'
_description = 'Lead To Opportunity Partner'
_inherit = 'crm.lead2partner'
_inherit = 'crm.generate.partner'
_columns = {
'name': fields.selection([

View File

@ -7,7 +7,7 @@
<field name="model">crm.lead2opportunity.partner</field>
<field name="arch" type="xml">
<form string="Convert to Opportunity" version="7.0">
<group>
<group name="name">
<field name="name" class="oe_inline"/>
<field name="opportunity_ids" attrs="{'invisible': [('name', '!=', 'merge')]}">
<tree>
@ -18,7 +18,7 @@
</tree>
</field>
</group>
<group attrs="{'invisible': [('name', '!=', 'convert')]}">
<group name="action" attrs="{'invisible': [('name', '!=', 'convert')]}">
<field name="action" class="oe_inline"/>
<field name="partner_id"
attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"