Atul Patel(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-import_sugarcrm-backlog10-atp into
lp:~openerp-dev/openobject-addons/trunk-import_sugarcrm.
Requested reviews:
tfr (Openerp) (tfr)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_sugarcrm-backlog10-atp/+merge/66081
Hello,
I had made changes:
1) Add explanation text
2) Add in configuration wizard (the crm windows in synchronization ) a check
box import
sugarcrm to install automaticly the module
3) Relate document with other module.
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-import_sugarcrm-backlog10-atp/+merge/66081
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-import_sugarcrm.
=== modified file 'crm/crm_installer.py'
--- crm/crm_installer.py 2011-01-14 00:11:01 +0000
+++ crm/crm_installer.py 2011-06-28 07:02:34 +0000
@@ -32,6 +32,7 @@
'crm_fundraising': fields.boolean('Fundraising', help="This may help associations in their fundraising process and tracking."),
'crm_claim': fields.boolean('Claims', help="Manages the suppliers and customers claims, including your corrective or preventive actions."),
'crm_caldav': fields.boolean('Calendar Synchronizing', help="Helps you to synchronize the meetings with other calendar clients and mobiles."),
+ 'import_sugarcrm': fields.boolean('Import SugarCRM', help="Helps you to Integration of SugarCRM data to OpenERP Modules."),
'sale_crm': fields.boolean('Opportunity to Quotation', help="This module relates sale from opportunity cases in the CRM."),
'fetchmail': fields.boolean('Fetch Emails', help="Allows you to receive E-Mails from POP/IMAP server."),
'thunderbird': fields.boolean('Thunderbird', help="Allows you to link your e-mail to OpenERP's documents. You can attach it to any existing one in OpenERP or create a new one."),
=== modified file 'crm/crm_installer_view.xml'
--- crm/crm_installer_view.xml 2011-01-14 00:11:01 +0000
+++ crm/crm_installer_view.xml 2011-06-28 07:02:34 +0000
@@ -36,6 +36,7 @@
<group colspan="2" col="2">
<separator string="Synchronization" colspan="4" />
<field name="crm_caldav" />
+ <field name="import_sugarcrm"/>
<field name="fetchmail" />
</group>
<group colspan="2" col="2">
=== modified file 'import_sugarcrm/import_sugarcrm.py'
--- import_sugarcrm/import_sugarcrm.py 2011-06-24 12:18:29 +0000
+++ import_sugarcrm/import_sugarcrm.py 2011-06-28 07:02:34 +0000
@@ -60,7 +60,7 @@
TABLE_NOTE = 'Notes'
TABLE_EMAIL = 'Emails'
TABLE_COMPAIGN = 'Campaigns'
- TABLE_DOCUMENT = 'DocumentRevisions'
+ TABLE_DOCUMENT = 'Documents'
TABLE_HISTORY_ATTACHMNET = 'history_attachment'
MAX_RESULT_PER_PAGE = 200
@@ -130,21 +130,52 @@
import Documents
"""
+ def import_related_document(self, val):
+ res_model = False
+ res_id = False
+ sugar_document_account = sugar.relation_search(self.context.get('port'), self.context.get('session_id'), 'Documents', module_id=val.get('id'), related_module='Accounts', query=None, deleted=None)
+ sugar_document_contact = sugar.relation_search(self.context.get('port'), self.context.get('session_id'), 'Documents', module_id=val.get('id'), related_module=self.TABLE_CONTACT, query=None, deleted=None)
+ sugar_document_opportunity = sugar.relation_search(self.context.get('port'), self.context.get('session_id'), 'Documents', module_id=val.get('id'), related_module=self.TABLE_OPPORTUNITY, query=None, deleted=None)
+ sugar_document_case = sugar.relation_search(self.context.get('port'), self.context.get('session_id'), 'Documents', module_id=val.get('id'), related_module=self.TABLE_CASE, query=None, deleted=None)
+ sugar_document_bug = sugar.relation_search(self.context.get('port'), self.context.get('session_id'), 'Documents', module_id=val.get('id'), related_module=self.TABLE_BUG, query=None, deleted=None)
+ for bug_id in sugar_document_bug:
+ res_id = self.get_mapped_id(self.TABLE_BUG, bug_id)
+ res_model = 'project.issue'
+ for case_id in sugar_document_case:
+ res_id = self.get_mapped_id(self.TABLE_CASE, case_id)
+ res_model = 'crm.claim'
+ for opportunity_id in sugar_document_opportunity:
+ res_id = self.get_mapped_id(self.TABLE_OPPORTUNITY, opportunity_id)
+ res_model = 'crm.lead'
+ for contact_id in sugar_document_contact:
+ res_id = self.get_mapped_id(self.TABLE_CONTACT, contact_id)
+ res_model = 'res.parner.address'
+ for account_id in sugar_document_account:
+ res_id = self.get_mapped_id(self.TABLE_ACCOUNT, account_id)
+ res_model = 'res.parner'
+ return res_id,res_model
+
def import_document(self, val):
- File,Filename = sugar.get_document_revision_search(self.context.get('port'), self.context.get('session_id'), val.get('id'))
- val['datas'] = File
- val['datas_fname'] = Filename
+ File,Filename = sugar.get_document_revision_search(self.context.get('port'), self.context.get('session_id'), val.get('document_revision_id'))
+ res_id, res_model = self.import_related_document(val)
+ val['res_id'] = res_id
+ val['res_model'] = res_model
+ if File:
+ val['datas'] = File
+ val['datas_fname'] = Filename
return val
def get_document_mapping(self):
return {
'model' : 'ir.attachment',
- 'dependencies' : [self.TABLE_USER],
+ 'dependencies' : [self.TABLE_USER, self.TABLE_ACCOUNT, self.TABLE_CONTACT, self.TABLE_OPPORTUNITY, self.TABLE_CASE, self.TABLE_BUG],
'hook' : self.import_document,
- 'map' : {'name':'filename',
+ 'map' : {'name':'document_name',
'description': ppconcat('description'),
'datas': 'datas',
'datas_fname': 'datas_fname',
+ 'res_model': 'res_model',
+ 'res_id': 'res_id'
}
}
@@ -900,7 +931,6 @@
'password': fields.char('Password', size=24,required=True),
'url' : fields.char('SugarSoap Api url:', size=264, required=True, help="Webservice's url where to get the data.\
example : 'http://example.com/sugarcrm/soap.php', or copy the address of your sugarcrm application http://trial.sugarcrm.com/qbquyj4802/index.php?module=Home&action=index"),
-
'opportunity': fields.boolean('Leads and Opportunities', help="If Opportunities are checked, SugarCRM opportunities data imported in OpenERP crm-Opportunity form"),
'contact': fields.boolean('Contacts', help="If Contacts are checked, SugarCRM Contacts data imported in OpenERP partner address form"),
'account': fields.boolean('Accounts', help="If Accounts are checked, SugarCRM Accounts data imported in OpenERP partners form"),
@@ -915,8 +945,11 @@
'document': fields.boolean('Documents', help="If Documents is checked, SugarCRM Documents data imported in OpenERP Document Form"),
'email_from': fields.char('Notify End Of Import To:', size=128),
'instance_name': fields.char("Instance's Name", size=64, help="Prefix of SugarCRM id to differentiate xml_id of SugarCRM models datas come from different server."),
-
}
+
+ def _get_email_id(self, cr, uid, context=None):
+ return self.pool.get('res.users').browse(cr, uid, uid, context=context).user_email
+
_defaults = {#to be set to true, but easier for debugging
'opportunity': False,
'contact' : False,
@@ -931,7 +964,7 @@
'bug': False,
'document': False,
'instance_name': 'sugarcrm',
- 'email_from': '[email protected]',
+ 'email_from': _get_email_id,
'username' : 'tfr',
'password' : 'a',
'url': "http://localhost/sugarcrm/soap.php"
@@ -1005,7 +1038,7 @@
if current.bug:
key_list.append('Bugs')
if current.document:
- key_list.append('DocumentRevisions')
+ key_list.append('Documents')
return key_list
=== modified file 'import_sugarcrm/import_sugarcrm_view.xml'
--- import_sugarcrm/import_sugarcrm_view.xml 2011-06-24 12:18:29 +0000
+++ import_sugarcrm/import_sugarcrm_view.xml 2011-06-28 07:02:34 +0000
@@ -12,11 +12,17 @@
<group col="8" >
<group colspan="2" col="1" width="200">
<label colspan="1" string=""/>
- <label colspan="2" string="Explaination Text"/>
- <label colspan="1" string="This Module Import SugarCRM Module Data into OpenERP Module."/>
+ <label colspan="2" string="Explaination Text:"/>
+ <label colspan="2" string="Import your data from SugarCRM.Use the SugarSoap API URL (read
+ tooltip), a full access Sugar login and choose groups of data you want to import.
+ Click 'Import' to get data manually or click 'schedule
+ reccurent import' to get recurrently and automatically data . If you
+ make recurrent or ponctual import, data already imported in OpenERP will
+ be erased by Sugar data. Don't forget to add an address email to be
+ notified of the success of the import."/>
<label colspan="2" />
- <label colspan="2" string="Here is Document links:"/>
- <label colspan="2" string="doc.openerp.com"/>
+ <label colspan="2" string="link to Documentation:"/>
+ <label colspan="2" string="(Comming Soon)"/>
<label colspan="2" string=""/>
</group>
<separator string="" orientation="vertical" colspan="1" rowspan="24" />
_______________________________________________
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