Jigar Amin (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-import_salesforce-b9_task-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_task-jam/+merge/67172
Changes - Task :
1) Difference Task and Email:
2) Import Email as history
kindly review this
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_salesforce-b9_task-jam/+merge/67172
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-07 10:54:02 +0000
+++ import_salesforce/wizard/import_salesforce.py 2011-07-07 11:41:30 +0000
@@ -52,6 +52,7 @@
TABLE_OPPOHISTORY = 'OpportunityHistory'
TABLE_ATTACHMENT = 'Attachment'
TABLE_TASK = 'Task'
+ TABLE_EMAIL = 'Email'
TABLE_PRODUCT = "Product2"
TABLE_EMPLOYEE = "Employee"
TABLE_PRODUCTCAT = "product.category"
@@ -85,6 +86,8 @@
where_clause = {
self.TABLE_FOLDER: " WHERE Type = 'Document'",
self.TABLE_CONVERTEDOPPO: " WHERE ConvertedOpportunityId != null",
+ self.TABLE_TASK: " WHERE not Subject LIKE 'Email%'",
+ self.TABLE_EMAIL: " WHERE Subject LIKE 'Email%'",
}
return where_clause.get(table, '')
@@ -94,7 +97,8 @@
"""
mapping = {
self.TABLE_EMPLOYEE: 'User',
- self.TABLE_CONVERTEDOPPO : 'Lead'
+ self.TABLE_CONVERTEDOPPO : 'Lead',
+ self.TABLE_EMAIL: 'Task',
}
return mapping.get(table, table)
@@ -119,6 +123,7 @@
self.TABLE_PRODUCT: self.get_product_mapping(),
self.TABLE_EMPLOYEE: self.get_employee_mapping(),
self.TABLE_ACCOUNT: self.get_account_mapping(),
+ self.TABLE_EMAIL: self.get_email_mapping(),
self.TABLE_OPPOHISTORY: self.get_oppo_history_mapping(),
self.TABLE_CONVERTEDOPPO: self.get_convertoppo_mapping(),
self.TABLE_ATTENDEE: self.get_attendee_mapping(),
@@ -614,6 +619,47 @@
}
}
+ def get_email_resource(self, vals):
+ model_map = {
+ self.TABLE_LEAD: 'crm.lead',
+ self.TABLE_OPPORTUNITY: 'crm.lead',
+ self.TABLE_ACCOUNT: 'res.partner',
+ }
+ if vals.get("WhoId"):
+ table = self.prefix_table.get(vals.get('WhoId')[0:3])
+ xmlid = self.xml_id_exist(table, vals.get('WhoId'))
+ if table == self.TABLE_CONTACT:
+ cid = self.get_mapped_id(table, vals.get('WhoId'))
+ vals.update({'PartnerId': cid})
+ else:
+ if model_map.get('table'):
+ vals.update({'Model': model_map.get('table'),
+ 'ResId': cid})
+ if vals.get('WhatId') and 'Model' not in vals:
+ table = self.prefix_table.get(vals.get('WhatId')[0:3])
+ xmlid = self.xml_id_exist(table, vals.get('WhatId'))
+ if xmlid and model_map.get('table'):
+ cid = self.get_mapped_id(table, vals.get('WhatId'))
+ vals.update({'Model': model_map.get('table'),
+ 'ResId': cid })
+ return vals
+
+ def get_email_mapping(self):
+ return {
+ 'model': 'mailgate.message',
+ 'dependencies': [self.TABLE_CONTACT, self.TABLE_LEAD, self.TABLE_OPPOHISTORY],
+ 'hook': self.get_email_resource,
+ 'map': {
+ 'name': call(self.get_subject),
+ 'user_id/id': ref(self.TABLE_USER, 'OwnerId'),
+ 'date': call(self.get_date, value('ActivityDate')),
+ 'description': 'Description',
+ 'model': "Model",
+ 'res_id': "ResId",
+ 'partner_id/.id': 'PartnerId'
+ }
+ }
+
def get_product_category(self, val, name):
fields = ['name']
data = [name]
@@ -859,7 +905,6 @@
return "Your Salesforce's data were successfully imported at %s" % self.date_ended
-
class import_salesforce(osv.osv):
'''
Model to Select SalesForce Model to be imported
@@ -910,7 +955,7 @@
if current.event:
nodes.append('Event')
if current.task:
- nodes.append('Task')
+ nodes.extend(['Task', 'Email'])
if current.attachment:
nodes.append('Attachment')
if current.folder:
_______________________________________________
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