Jigar Amin (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-import_salesforce-b9_contact_address-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_contact_address-jam/+merge/67929
Changes : Contact :
- One address Per Contact, We don't import Other(type) address Detail.
Kindly Review this.
Thank You
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_salesforce-b9_contact_address-jam/+merge/67929
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-13 07:28:32 +0000
+++ import_salesforce/wizard/import_salesforce.py 2011-07-14 08:45:14 +0000
@@ -820,43 +820,7 @@
}
}
- def get_address_vals(self, key, vals):
- address = {
- 'contact': {
- 'contact_name': vals.get('Name', ''),
- 'type': key,
- 'street': vals.get('MailingStreet', ''),
- 'zip': vals.get('MailingPostalCode', ''),
- 'city': vals.get('MailingCity', ''),
- 'phone': vals.get('Phone', ''),
- 'mobile': vals.get('MobilePhone', ''),
- 'email': vals.get('Email', ''),
- 'fax': vals.get('Fax', ''),
- 'function': vals.get('Title', ''),
- 'title': self.get_title(vals, vals.get('Salutation'), 'contact'),
- 'state_id/id': vals.get('MailingState', False),
- 'country_id/id': vals.get('MailingCountry', False),
- },
- 'other': {
- 'contact_name': vals.get('Name', ''),
- 'type': key,
- 'street': vals.get('OtherStreet', ''),
- 'zip': vals.get('OtherPostalCode', ''),
- 'city': vals.get('OtherCity', ''),
- 'phone': vals.get('OtherPhone', ''),
- 'mobile': vals.get('MobilePhone', ''),
- 'email': vals.get('Email', ''),
- 'fax': vals.get('Fax', ''),
- 'function': vals.get('Title', ''),
- 'title': self.get_title(vals, vals.get('Salutation'), 'contact'),
- 'country_id/id': vals.get('OtherCountry', False),
- 'state_id/id': vals.get('OtherState', False),
- },
- }
- return address.get(key, False)
-
def get_partner_address(self, vals):
- address_types = ['contact', 'other']
address_ids = []
address = {
'name': 'contact_name',
@@ -873,24 +837,30 @@
'function': 'function',
'title/id': 'title',
}
- for add_type in address_types:
- val = self.get_address_vals(add_type, vals)
- country = state = False
- if add_type == "contact":
- if vals.get('MailingCountry'):
- country = self.get_all_countries(vals.get('MailingCountry'))
- if vals.get('MailingState'):
- state = self.get_all_states(vals.get('MailingState'), country)
- if add_type == "other":
- if vals.get('OtherCountry'):
- country = self.get_all_countries(vals.get('OtherCountry'))
- if vals.get('OtherState'):
- state = self.get_all_states(vals.get('OtherState'), country)
- val.update({'country_id/id': country,
- 'state_id/id': state,
- 'id_new': vals['Id'] + '_address_' + add_type})
- 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)
+ val = {
+ 'contact_name': vals.get('Name', ''),
+ 'type': 'contact',
+ 'street': vals.get('MailingStreet', ''),
+ 'zip': vals.get('MailingPostalCode', ''),
+ 'city': vals.get('MailingCity', ''),
+ 'phone': vals.get('Phone', ''),
+ 'mobile': vals.get('MobilePhone', ''),
+ 'email': vals.get('Email', ''),
+ 'fax': vals.get('Fax', ''),
+ 'function': vals.get('Title', ''),
+ 'title': self.get_title(vals, vals.get('Salutation'), 'contact'),
+ 'state_id/id': False,
+ 'country_id/id': False,
+ }
+ country = state = False
+ if vals.get('MailingCountry'):
+ country = self.get_all_countries(vals.get('MailingCountry'))
+ if vals.get('MailingState'):
+ state = self.get_all_states(vals.get('MailingState'), country)
+ val.update({'country_id/id': country,
+ 'state_id/id': state,
+ 'id_new': vals['Id'] + '_address_' + 'contact'})
+ address_ids.append(self.import_object_mapping(address, val, 'res.partner.address', self.TABLE_CONTACT, val['id_new'], self.DO_NOT_FIND_DOMAIN))
return ','.join(address_ids)
def get_contact_mapping(self):
@@ -899,7 +869,7 @@
'dependencies': [self.TABLE_USER, self.TABLE_ACCOUNT],
'map': {
'name': 'Name',
- 'customer': const('0'),
+ 'customer': const('1'),
'supplier': const('0'),
'title/id': call(self.get_title, value('Title'), const('partner')),
'address/id': self.get_partner_address,
_______________________________________________
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