Jigar Amin  (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-import_salesforce-b9_account-jam into 
lp:~openerp-dev/openobject-addons/trunk-import_salesforce.

Requested reviews:
  Bhumika (OpenERP) (sbh-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_salesforce-b9_account-jam/+merge/66991

Changes : 
  1) SF : AccountOwner => OE : Salesman,
  2) Parent Account => Parent Partner,
  3)In description - ppconcat (Account Site, Type, Industry, Annual revenue, 
Priority,  SLA expiration date, Number of location, Description, Ticker Symbol, 
Ownership, Employees, Sic code, SLA ,SLA serial number)
  4) and Code usability Improved
Kindly Review this,
Thank You 

-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_salesforce-b9_account-jam/+merge/66991
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-import_salesforce.
=== modified file 'import_salesforce/wizard/import_salesforce.py'
--- import_salesforce/wizard/import_salesforce.py	2011-07-05 04:58:26 +0000
+++ import_salesforce/wizard/import_salesforce.py	2011-07-06 06:33:03 +0000
@@ -78,9 +78,9 @@
             self.TABLE_MEETING: "SELECT Id, Subject, OwnerId, WhoId, Location, Description, StartDateTime, EndDateTime, IsRecurrence, IsAllDayEvent, DurationInMinutes, RecurrenceType, RecurrenceInterval, RecurrenceEndDateOnly, RecurrenceDayOfWeekMask, RecurrenceDayOfMonth, RecurrenceInstance FROM %s"%(self.TABLE_MEETING),
             self.TABLE_ATTACHMENT: "SELECT Id, Name, Description, ParentId FROM Attachment",
             self.TABLE_TASK: "SELECT Id, Subject, OwnerId, ActivityDate, CallDurationInSeconds, Description, WhoId FROM %s"%(self.TABLE_TASK),
-            self.TABLE_PRODUCT: "SELECT Id,CreatedById, Description, Family, IsActive, Name, ProductCode FROM %s"%(self.TABLE_PRODUCT),    
+            self.TABLE_PRODUCT: "SELECT Id,CreatedById, Description, Family, IsActive, Name, ProductCode FROM %s"%(self.TABLE_PRODUCT),
             self.TABLE_EMPLOYEE: "SELECT Id, Phone, Email, MobilePhone, Name, Department, IsActive,  ManagerId FROM %s"%(self.TABLE_USER),
-            self.TABLE_ACCOUNT: "SELECT Id, Name, AccountNumber, OwnerId, Site, AnnualRevenue, Fax, Phone, Website , BillingStreet, BillingCity, BillingState, BillingCountry, BillingPostalCode, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry FROM %s"%(self.TABLE_ACCOUNT)
+            self.TABLE_ACCOUNT: "SELECT Id, Name, AccountNumber, OwnerId, ParentId, Fax, Phone, Website , BillingStreet, BillingCity, BillingState, BillingCountry, BillingPostalCode, ShippingStreet, ShippingCity, ShippingState, ShippingPostalCode, ShippingCountry, Site, Type, Industry, AnnualRevenue, Description, TickerSymbol, Ownership, NumberOfEmployees, Sic, SLA__c, SLASerialNumber__c, CustomerPriority__c, SLAExpirationDate__c, NumberofLocations__c FROM %s"%(self.TABLE_ACCOUNT),
         }
 
     def get_data(self, table):
@@ -150,16 +150,15 @@
                 'country_id/id': 'CountryId',
                 'state_id/id': 'StateId',
             }
-
-            val.update({'Type':'contact'})
+            val.update({'Type': 'contact'})
             country = state = False
             if val.get('Country'):
                 country = self.get_all_countries(val.get('Country'))
             if val.get('State'):
                 state = self.get_all_states(val.get('State'), country)
-            val.update({'CountryId': country,'StateId': state,'id_new': val['Id']+'address_contact' })
-            return self.import_object_mapping(field_map , val, 'res.partner.address', self.TABLE_CONTACT, val['id_new'], self.DO_NOT_FIND_DOMAIN)
-        
+            val.update({'CountryId': country, 'StateId': state, 'id_new': val['Id']+'address_contact'})
+            return self.import_object_mapping(field_map, val, 'res.partner.address', self.TABLE_CONTACT, val['id_new'], self.DO_NOT_FIND_DOMAIN)
+
     def get_user_mapping(self):
         return {
             'model': 'res.users',
@@ -170,7 +169,7 @@
                     'user_email': 'Email',
                     'context_tz': 'TimeZoneSidKey',
                     'context_lang': 'LanguageLocaleKey',
-                    'address_id/id' : self.get_user_address,
+                    'address_id/id': self.get_user_address,
                 }
         }
 
@@ -315,7 +314,7 @@
     def get_channel(self, vals, val):
         if not val:
             return False
-        
+
         fields = ['name']
         name = 'lead_' + val
         data = [val]
@@ -326,12 +325,12 @@
             vals['country_id/id']= self.get_all_countries(vals.get('Country'))
             vals['state_id/id'] = self.get_all_states(vals.get('State'), vals['country_id/id'])
         return vals
-        
+
     def get_lead_mapping(self):
         return{
             'model': 'crm.lead',
             'dependencies': [self.TABLE_USER],
-            'hook' : self.import_lead,
+            'hook': self.import_lead,
             'map': {
                         'name': 'Company',
                         'title/id': call(self.get_title, value('Salutation'), const('contact')),
@@ -353,7 +352,7 @@
                         'country_id/id': 'country_id/id',
                         'state_id/id': 'state_id/id',
                         'channel_id/id': call(self.get_channel, value('LeadSource')),
-                        'type' : const('lead'),
+                        'type': const('lead'),
                     }
             }
 
@@ -481,7 +480,7 @@
                     add_id =  address['contact']
                 if add_id:
                     address_rec = address_pool.browse(self.cr, self.uid, add_id)
-                    val.update({'partner_address_id':add_id,
+                    val.update({'partner_address_id': add_id,
                                 'email_from': address_rec.email,
                                 'partner_phone': address_rec.phone})
         return val
@@ -510,7 +509,7 @@
                     'state': map_val('Status', self.claim_state_map, default='draft'),
                 }
         }
-        
+
     def get_date(self, val, field):
         date = datetime.datetime.now().strftime(self.DATETIME_FORMAT)
         if field:
@@ -685,14 +684,14 @@
                     'email_from': 'Email',
             }
         }
-        
+
     def get_email_subject(self, result):
         return "Your Salesforce's data were successfully imported at %s" % self.date_ended
 
     def get_product_category(self, val, name):
-        
+
         fields = ['name']
-        nameid =  'product_category_'+name 
+        nameid =  'product_category_'+name
         data = [name]
         return self.import_object(fields, data, self.TABLE_PRODUCTCAT, self.TABLE_PRODUCTCAT, nameid, [('name', 'ilike', name)])
 
@@ -704,29 +703,29 @@
             for book in pricebook:
                 if book.get('IsStandard'):
                     costprice = plist.get('UnitPrice', 1.00)
-                else: 
+                else:
                     listprice = plist.get('UnitPrice', 1.00)
         val.update({'StandardPrice': costprice,
-                    'ListPrice':listprice })
+                    'ListPrice': listprice})
         return val
-        
+
     def get_product_mapping(self):
         return {
             'model': 'product.product',
             'dependencies': [self.TABLE_USER],
-            'hook': self.get_product,         
+            'hook': self.get_product,
             'map': {
                     'name': 'Name',
                     'active': map_val('IsActive', self.boolean_map),
                     'default_code': 'ProductCode',
                     'description': 'Description',
-                    'product_manager/id': ref(self.TABLE_USER, 'CreatedById'), 
+                    'product_manager/id': ref(self.TABLE_USER, 'CreatedById'),
                     'categ_id/id': call(self.get_product_category, value('Family')),
                     'standard_price': 'StandardPrice',
                     'list_price': 'ListPrice',
                 }
         }
-    
+
     def get_employee(self, val):
         users_pool = self.obj.pool.get('res.users')
         user = self.xml_id_exist(self.TABLE_USER, val.get('Id'))
@@ -737,7 +736,7 @@
         return val
 
     def get_department(self, val, dept):
-        if dept: 
+        if dept:
             fields = ['name']
             nameid = val.get('Id')+"_hr_department_"+dept
             data = [dept]
@@ -758,10 +757,10 @@
                     'mobile_phone': 'MobilePhone',
                     'work_email': 'Email',
                     'parent_id/id_parent': 'ManagerId',
-                    'department_id/id': call(self.get_department, value('Department'))
+                    'department_id/id': call(self.get_department, value('Department')),
                 }
         }
-        
+
     def get_account_vals(self, key, vals):
         address = {
             'invoice': {
@@ -790,7 +789,7 @@
             },
         }
         return address.get(key, False)
-    
+
     def get_account_address(self, vals):
         address_types = ['delivery', 'invoice']
         address_ids = []
@@ -825,7 +824,7 @@
             add_id= self.import_object_mapping(address, val, 'res.partner.address', self.TABLE_CONTACT, val['id_new'], self.DO_NOT_FIND_DOMAIN)
             address_ids.append(add_id)
         return ','.join(address_ids)
-        
+
     def get_account_mapping(self):
         return {
             'model': 'res.partner',
@@ -836,10 +835,14 @@
                 'customer': const('1'),
                 'supplier': const('0'),
                 'address/id': self.get_account_address,
-                'website': 'Website'
+                'user_id/id': ref(self.TABLE_USER, 'OwnerId'),
+                'parent_id/id_parent': 'ParentId',
+                'website': 'Website',
+                'comment': ppconcat('Site', 'Type', 'Industry', 'AnnualRevenue', 'CustomerPriority__c', 'TickerSymbol', 'Ownership', 'NumberofLocations__c', 'NumberOfEmployees', 'Sic', 'SLA__c', 'SLASerialNumber__c', 'SLAExpirationDate__c', 'Description'),
                 }
         }
 
+
 class import_salesforce(osv.osv):
     '''
         Model to Select SalesForce Model to be imported
@@ -868,7 +871,6 @@
 
     _defaults = {
         'instance_name': 'salesforce',
-        
     }
 
     def _get_nodes(self, cr, uid, ids, context=None):
@@ -881,11 +883,11 @@
             if current.contact:
                 nodes.append('Contact')
             if current.lead:
-                nodes.extend(['Lead', 'Opportunity'])                
+                nodes.extend(['Lead', 'Opportunity'])
             if current.employee:
                 nodes.append('Employee')
             if current.account:
-                nodes.append('Account')                
+                nodes.append('Account')
             if current.case:
                 nodes.append('Case')
             if current.event:
@@ -899,7 +901,7 @@
             if current.document:
                 nodes.append('Document')
             if current.product:
-                nodes.append('Product2')                
+                nodes.append('Product2')
         return nodes
 
     def import_all(self, cr, uid, ids, context=None):
@@ -907,7 +909,7 @@
         if context == None:
             context = {}
         tables = self._get_nodes(cr, uid, ids, context)
-        
+
         for current in self.browse(cr, uid, ids, context):
             context.update({'username': current.name,
                             'passtoken': current.password+current.token})

_______________________________________________
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