← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~jeffery9/ocb-addons/ocb-addons-fixups into lp:ocb-addons

 

jeffery chen fan has proposed merging lp:~jeffery9/ocb-addons/ocb-addons-fixups into lp:ocb-addons.

Requested reviews:
  OpenERP Community Backports Team (ocb)

For more details, see:
https://code.launchpad.net/~jeffery9/ocb-addons/ocb-addons-fixups/+merge/194463

fixed some bugs in crm application
-- 
https://code.launchpad.net/~jeffery9/ocb-addons/ocb-addons-fixups/+merge/194463
Your team OpenERP Community Backports Team is requested to review the proposed merge of lp:~jeffery9/ocb-addons/ocb-addons-fixups into lp:ocb-addons.
=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py	2013-08-27 16:20:36 +0000
+++ crm/crm_lead.py	2013-11-08 08:51:23 +0000
@@ -738,7 +738,11 @@
             'is_company': is_company,
             'type': 'contact'
         }
-        partner = partner.create(cr, uid, vals, context=context)
+        partner_ids = partner.search(cr, uid, [('name', '=', name),('is_company','=',True)], context=context)
+        if partner_ids:
+            partner = partner_ids[0]
+        else:
+            partner = partner.create(cr, uid, vals, context=context)
         return partner
 
     def _create_lead_partner(self, cr, uid, lead, context=None):

=== modified file 'crm/crm_phonecall_view.xml'
--- crm/crm_phonecall_view.xml	2012-10-23 16:05:04 +0000
+++ crm/crm_phonecall_view.xml	2013-11-08 08:51:23 +0000
@@ -133,12 +133,12 @@
                 <field name="partner_id"
                     on_change="onchange_partner_id(partner_id)"/>
                 <field name="partner_phone"
-                    invisible="1"/>
+                    />
                 <field name="user_id"/>
                 <field name="categ_id" widget="selection"
                     domain="[('object_id.model', '=', 'crm.phonecall')]"
-                    invisible="1"/>
-                <field name="state" invisible="1"/>
+                    />
+                <field name="state"/>
                 <field name="create_date" invisible="1"/>
                 <field name="opportunity_id" invisible="1" on_change="on_change_opportunity(opportunity_id)"/>
                 <button string="Schedule Other Call"

=== modified file 'crm/wizard/crm_lead_to_opportunity.py'
--- crm/wizard/crm_lead_to_opportunity.py	2013-09-30 14:12:02 +0000
+++ crm/wizard/crm_lead_to_opportunity.py	2013-11-08 08:51:23 +0000
@@ -37,6 +37,9 @@
         'opportunity_ids': fields.many2many('crm.lead', string='Opportunities'),
     }
 
+    def onchange_action(self, cr, uid, ids, action, context=None):
+        return {'value': {'partner_id': False if action != 'exist' else self._find_matching_partner(cr, uid, context=context)}}
+
     def default_get(self, cr, uid, fields, context=None):
         """
         Default get for name, opportunity_ids.

=== modified file 'crm/wizard/crm_lead_to_opportunity_view.xml'
--- crm/wizard/crm_lead_to_opportunity_view.xml	2012-10-23 16:05:04 +0000
+++ crm/wizard/crm_lead_to_opportunity_view.xml	2013-11-08 08:51:23 +0000
@@ -27,7 +27,7 @@
                         </field>
                     </group>
                     <group name="action" attrs="{'invisible': [('name', '!=', 'convert')]}">
-                        <field name="action" class="oe_inline"/>
+                        <field name="action" on_change="onchange_action(action, context)" class="oe_inline"/>
                         <field name="partner_id"
                             attrs="{'required': [('action', '=', 'exist')], 'invisible':[('action','!=','exist')]}"
                             class="oe_inline"/>

=== modified file 'crm/wizard/crm_partner_binding.py'
--- crm/wizard/crm_partner_binding.py	2012-10-23 16:05:04 +0000
+++ crm/wizard/crm_partner_binding.py	2013-11-08 08:51:23 +0000
@@ -73,6 +73,13 @@
                 if partner_ids:
                     partner_id = partner_ids[0]
             # Search through the existing partners based on the lead's partner or contact name
+            elif active_model.partner_name and active_model.contact_name:
+                company_ids = partner_obj.search(cr, uid, [('name', 'ilike', '%'+active_model.partner_name+'%')], context=context)
+                if company_ids:
+                    company_id = company_ids[0]
+                    partner_ids = partner_obj.search(cr, uid, [('name', 'ilike', '%'+active_model.contact_name+'%'),('parent_id', '=', company_id)], context=context) 
+                    if partner_ids:
+                        partner_id = partner_ids[0]
             elif active_model.partner_name:
                 partner_ids = partner_obj.search(cr, uid, [('name', 'ilike', '%'+active_model.partner_name+'%')], context=context)
                 if partner_ids:

=== modified file 'crm/wizard/crm_phonecall_to_phonecall_view.xml'
--- crm/wizard/crm_phonecall_to_phonecall_view.xml	2012-10-23 16:05:04 +0000
+++ crm/wizard/crm_phonecall_to_phonecall_view.xml	2013-11-08 08:51:23 +0000
@@ -36,6 +36,7 @@
             <field name="view_mode">form</field>
             <field name="view_id" ref="phonecall_to_phonecall_view"/>
             <field name="target">new</field>
+            <field name="context">{'default_state': 'open'}</field>
         </record>
 
     </data>


Follow ups