[IMP]: Change Explanation Text.Link document with other user and set default user email

bzr revid: atp@tinyerp.com-20110628051001-0n9pqhdpkoyo6yfm
This commit is contained in:
Atul Patel (OpenERP) 2011-06-28 10:40:01 +05:30
parent d4eeb2a661
commit e423d7efd5
4 changed files with 55 additions and 14 deletions

View File

@ -32,6 +32,7 @@ class crm_installer(osv.osv_memory):
'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."),

View File

@ -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">

View File

@ -60,7 +60,7 @@ class sugar_import(import_framework):
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 @@ class sugar_import(import_framework):
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 @@ class import_sugarcrm(osv.osv):
'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 @@ class import_sugarcrm(osv.osv):
'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 @@ class import_sugarcrm(osv.osv):
'bug': False,
'document': False,
'instance_name': 'sugarcrm',
'email_from': 'tfr@openerp.com',
'email_from': _get_email_id,
'username' : 'tfr',
'password' : 'a',
'url': "http://localhost/sugarcrm/soap.php"
@ -1005,7 +1038,7 @@ class import_sugarcrm(osv.osv):
if current.bug:
key_list.append('Bugs')
if current.document:
key_list.append('DocumentRevisions')
key_list.append('Documents')
return key_list

View File

@ -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" />