[imp] improved lead and opportunity

bzr revid: han@tinyerp.com-20111013093804-phr519y2k9vcy17d
This commit is contained in:
Hardik Ansodariy (OpenERP) 2011-10-13 15:08:04 +05:30
parent 9ceaf4fdf3
commit 47ccc4e421
6 changed files with 57 additions and 10 deletions

View File

@ -270,6 +270,8 @@
<field name="categ_id" ref="crm.categ_oppor3"/>
<field name="stage_id" ref="crm.stage_lead2"/>
<field eval="'Pricing Information of Onsite Intervention'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 1) +'/'+ time.strftime('%d')" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 2) +'/'+ time.strftime('%d')" name="date_deadline"/>
<field eval="'Send price list regarding our interventions'" name="title_action"/>
<field name="partner_name">BalmerInc S.A.</field>
<field name="street">Rue des Palais 51, bte 33</field>
@ -291,6 +293,8 @@
<field name="categ_id" ref="crm.categ_oppor3"/>
<field name="stage_id" ref="crm.stage_lead2"/>
<field eval="'Interest in your Kitchen Design Project'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 1) +'/'+ time.strftime('%d')" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 2) +'/'+ time.strftime('%d')" name="date_deadline"/>
<field eval="'Send Catalogue by E-Mail'" name="title_action"/>
<field name="partner_name">Lucie Vonck</field>
<field name="street">Chaussée de Namur</field>
@ -313,6 +317,8 @@
<field name="categ_id" ref="crm.categ_oppor6"/>
<field name="stage_id" ref="crm.stage_lead2"/>
<field eval="'Plan train our students on your product'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 1) +'/'+ time.strftime('%d')" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 2) +'/'+ time.strftime('%d')" name="date_deadline"/>
<field eval="'Call to define real needs about training'" name="title_action"/>
<field eval="4000" name="zip"/>
<field name="partner_name">Université de Liège</field>
@ -336,6 +342,8 @@
<field name="categ_id" ref="crm.categ_oppor2"/>
<field name="stage_id" ref="crm.stage_lead2"/>
<field eval="'Plan to buy 66 keyboards and 66 mouses'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 1) +'/'+ time.strftime('%d')" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 2) +'/'+ time.strftime('%d')" name="date_deadline"/>
<field eval="'Propose the kit keyboard+mouse'" name="title_action"/>
<field name="partner_name">Bank Wealthy and sons</field>
<field name="street">1 rue Rockfeller</field>
@ -359,6 +367,7 @@
<field name="categ_id" ref="crm.categ_oppor7"/>
<field name="stage_id" ref="crm.stage_lead5"/>
<field eval="'Need 20 Days of Consultancy'" name="name"/>
<field eval="time.strftime('%Y-%m-%d')" name="date_deadline"/>
<field eval="'info@mycompany.net'" name="email_from"/>
</record>
<record id="crm_case_abcfuelcounits0" model="crm.lead">
@ -376,6 +385,8 @@
<field name="categ_id" ref="crm.categ_oppor5"/>
<field name="stage_id" ref="crm.stage_lead4"/>
<field eval="'Need new design for my website'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ time.strftime('%m') +'/'+ str(int(time.strftime('%d')) + 15)" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ time.strftime('%m') +'/'+ str(int(time.strftime('%d')) + 15)" name="date_deadline"/>
<field eval="'info@opensides.be'" name="email_from"/>
<field eval="'Convert to quote'" name="title_action"/>
<field name="partner_name">Dubois sprl</field>
@ -428,6 +439,8 @@
<field name="categ_id" ref="crm.categ_oppor2"/>
<field name="stage_id" ref="crm.stage_lead2"/>
<field eval="'Plan to attend a training'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 1) +'/'+ time.strftime('%d')" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 2) +'/'+ time.strftime('%d')" name="date_deadline"/>
<field eval="'Call to give info about next training session'" name="title_action"/>
<field name="partner_name">Axelor</field>
<field name="street">12 rue Albert Einstein</field>
@ -450,6 +463,8 @@
<field name="categ_id" ref="crm.categ_oppor1"/>
<field name="stage_id" ref="crm.stage_lead3"/>
<field eval="'Need customize the solution'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ time.strftime('%m') +'/'+ str(int(time.strftime('%d')) + 15)" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 1) +'/'+ time.strftime('%d')" name="date_deadline"/>
<field eval="'Conf call with technical service'" name="title_action"/>
<field name="partner_name">Thymbra</field>
<field name="street">Palermo, Capital Federal</field>
@ -473,6 +488,8 @@
<field name="categ_id" ref="crm.categ_oppor1"/>
<field name="stage_id" ref="crm.stage_lead3"/>
<field eval="'Interest in your customizable PC'" name="name"/>
<field eval="time.strftime('%Y') +'/'+ time.strftime('%m') +'/'+ str(int(time.strftime('%d')) + 15)" name="date_action"/>
<field eval="time.strftime('%Y') +'/'+ str(int(time.strftime('%m')) + 1) +'/'+ time.strftime('%d')" name="date_deadline"/>
<field eval="'Ask for the good receprion of the proposition'" name="title_action"/>
<field name="partner_name">Eric Dubois</field>
<field name="street">Chaussée de Binche, 27</field>

View File

@ -462,7 +462,7 @@
<field name="user_id"/>
<button string="Schedule/Log Call"
name="%(opportunity2phonecall_act)d" icon="terp-call-start" type="action" groups="base.group_extended"/>
name="%(opportunity2phonecall_act)d" icon="terp-call-start" type="action"/>
<field name="planned_revenue"/>
<field name="probability"/>

View File

@ -261,7 +261,6 @@
parent="base.next_id_64" action="action_report_crm_lead" sequence="3"/>
<menuitem name="Opportunities Analysis" id="menu_report_crm_opportunities_tree"
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_opportunity" sequence="4"/>
</data>

View File

@ -86,8 +86,20 @@ class crm_lead2partner(osv.osv_memory):
partner_ids = partner_obj.search(cr, uid, [('address', 'in', address_ids)], context=context)
# Find partner name that matches the name of the lead
if not partner_ids and lead.partner_name:
partner_ids = partner_obj.search(cr, uid, [('name', '=', lead.partner_name)], context=context)
if type(lead.partner_name).__name__ == 'unicode':
partner_name = str(lead.partner_name)
partner_name = partner_name.capitalize()
partner = ''
upper = False
for name in partner_name:
if upper:
partner+=name.upper()
else:
partner+=name
upper = name.isspace()
if not partner_ids and partner:
partner_ids = partner_obj.search(cr, uid, [('name', '=', partner)], context=context)
partner_id = partner_ids and partner_ids[0] or False

View File

@ -35,13 +35,16 @@ class crm_opportunity2phonecall(osv.osv_memory):
_columns = {
'name' : fields.char('Call summary', size=64, required=True, select=1),
'user_id' : fields.many2one('res.users', "Assign To"),
'contact_name':fields.char('Contact', size=64),
'phone':fields.char('Phone', size=64),
'partner_id' : fields.many2one('res.partner', "Partner"),
'date': fields.datetime('Date'),
'section_id': fields.many2one('crm.case.section', 'Sales Team'),
'categ_id': fields.many2one('crm.case.categ', 'Category', \
domain="['|',('section_id','=',False),('section_id','=',section_id),\
('object_id.model', '=', 'crm.phonecall')]"),
'action': fields.selection([('schedule','Schedule a call'), ('log','Log a call')], 'Action', required=True),
'action': fields.selection([('schedule','Schedule a call'), ('log','Log a call')], 'Action', required=True),
'note':fields.text('Note'),
}
def default_get(self, cr, uid, fields, context=None):
@ -64,7 +67,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
record_ids = context and context.get('active_ids', []) or []
res = super(crm_opportunity2phonecall, self).default_get(cr, uid, fields, context=context)
res.update({'action': 'schedule', 'date': time.strftime('%Y-%m-%d %H:%M:%S')})
res.update({'action': 'log', 'date': time.strftime('%Y-%m-%d %H:%M:%S')})
for opp in opp_obj.browse(cr, uid, record_ids, context=context):
if 'name' in fields:
res.update({'name': opp.name})
@ -76,6 +79,12 @@ class crm_opportunity2phonecall(osv.osv_memory):
res.update({'categ_id': categ_id})
if 'partner_id' in fields:
res.update({'partner_id': opp.partner_id and opp.partner_id.id or False})
if 'note' in fields:
res.update({'note': opp.description})
if 'contact_name' in fields:
res.update({'contact_name': opp.partner_address_id and opp.partner_address_id.name or False})
if 'phone' in fields:
res.update({'phone': opp.phone or (opp.partner_address_id and opp.partner_address_id.phone or False)})
return res
def action_cancel(self, cr, uid, ids, context=None):
@ -142,6 +151,7 @@ class crm_opportunity2phonecall(osv.osv_memory):
if this.action == 'log':
phonecall_obj.case_close(cr, uid, [new_case])
return {'type': 'ir.actions.act_window_close'}
value = {
'name': _('Phone Call'),

View File

@ -16,10 +16,19 @@
<field name="name"/>
<field name="date" string="Planned Date" attrs="{'invisible': [('action','=','log')]}"/>
<newline/>
<field name="partner_id" readonly="True"/>
<field name="user_id" />
<field name="section_id" widget="selection" />
<field name="categ_id" string="Type" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
<group colspan="4">
<field name="partner_id" readonly="True"/>
<field name="categ_id" string="Type" widget="selection" domain="[('object_id.model', '=', 'crm.phonecall')]"/>
<field name="contact_name"/>
<field name="phone"/>
</group>
<group colspan="4">
<field name="user_id" attrs="{'invisible': [('action','=','log')]}"/>
<field name="section_id" widget="selection" attrs="{'invisible': [('action','=','log')]}"/>
</group>
<group colspan="4">
<field name="note"/>
</group>
<separator string="" colspan="4"/>
<group colspan="4" col="3">
<button name="action_cancel" string="_Cancel" icon="gtk-cancel" special="cancel" />