Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.1-opw-576325-ado into 
lp:openobject-addons/6.1.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-576325-ado/+merge/114368

Hello,

[FIX] : lead does't save the res_partner_contact information with base_contact 
module

Steps :
1. create database then install crm
2. install base_contact
3. fill the fields title + mobile on the lead and try to save the lead values 
of this fields will disappear

The problem is occur when this fields are related not char.

Regards,
Amit Dodiya
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.1-opw-576325-ado/+merge/114368
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.1-opw-576325-ado.
=== modified file 'base_contact/base_contact.py'
--- base_contact/base_contact.py	2012-02-15 13:22:13 +0000
+++ base_contact/base_contact.py	2012-07-11 09:24:36 +0000
@@ -209,7 +209,9 @@
         'name' : fields.related('contact_id', 'name', type='char', size=64, string="Contact Name", store=True),
         'title' : fields.related('contact_id', 'title', type='many2one', relation='res.partner.title', string="Title", store=True),
     }
-    def create(self, cr, uid, data, context={}):
+    def create(self, cr, uid, data, context=None):
+        if context is None:
+            context = {} 
         if not data.get('location_id', False):
             loc_id = self.pool.get('res.partner.location').create(cr, uid, {
                 'street': data.get('street',''),
@@ -220,6 +222,15 @@
                 'state_id': data.get('state_id',False)
             }, context=context)
             data['location_id'] = loc_id
+        if not data.get('contact_id', False) and data.get('name', False):
+            con_id = self.pool.get('res.partner.contact').create(cr, uid, {
+                 'last_name': data.get('name', ''),
+                 'title': data.get('title', ''),
+                 'partner_id': data.get('partner_id', False),
+                 'function' : data.get('function', ''),
+                 'mobile' : data.get('mobile', '')
+            }, context=context)
+            data['contact_id'] = con_id
         result = super(res_partner_address, self).create(cr, uid, data, context=context)
         return result
 

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to