[IMP]: Add attachment as Different module.

bzr revid: atp@tinyerp.com-20110414125154-pq50pfucad5v2vmo
This commit is contained in:
Atul Patel (OpenERP) 2011-04-14 18:21:54 +05:30
parent 8b39c2a697
commit 30d1bcb232
4 changed files with 16 additions and 8 deletions

View File

@ -638,7 +638,7 @@ def get_attachment(sugar_obj, cr, uid, val, model, File, context=None):
mailgate_obj.write(cr, uid, [message_xml_id[0].res_id], {'attachment_ids': [(4, new_attachment_id)]})
return True
def import_history(sugar_obj, cr, uid, xml_id, model, context=None):
def import_history(sugar_obj, cr, uid, context=None):
if not context:
context = {}
map_attachment = {'id' : 'id',
@ -655,7 +655,7 @@ def import_history(sugar_obj, cr, uid, xml_id, model, context=None):
sugar_data = sugar.search(PortType, sessionid, 'Notes')
for val in sugar_data:
File = sugar.attachment_search(PortType, sessionid, 'Notes', val.get('id'))
model_ids = model_obj.search(cr, uid, [('name', 'like', xml_id)])
model_ids = model_obj.search(cr, uid, [('name', 'like', val.get('parent_id'))])
for model in model_obj.browse(cr, uid, model_ids):
val['res_id'] = model.res_id
val['model'] = model.model
@ -952,7 +952,11 @@ MAP_FIELDS = {'Opportunities': #Object Mapping name
'Bugs':
{'dependencies' : ['Users', 'Projects', 'Project Tasks'],
'process' : import_bug,
},
},
'Notes':
{'dependencies' : ['Users', 'Projects', 'Project Tasks', 'Accounts', 'Contacts', 'Leads', 'Opportunities', 'Meetings', 'Calls'],
'process' : import_history,
},
'Resources':
{'dependencies' : ['Users'],
'process' : import_resources,
@ -977,6 +981,7 @@ class import_sugarcrm(osv.osv):
'project': fields.boolean('Projects', help="If Projects is checked, SugarCRM Projects data imported in OpenERP Projects form"),
'project_task': fields.boolean('Project Tasks', help="If Project Tasks is checked, SugarCRM Project Tasks data imported in OpenERP Project Tasks form"),
'bug': fields.boolean('Bugs', help="If Bugs is checked, SugarCRM Bugs data imported in OpenERP Project Issues form"),
'attachment': fields.boolean('Attachments', help="If Attachments is checked, SugarCRM Notes data imported in OpenERP's Related module's History with attachment"),
'username': fields.char('User Name', size=64),
'password': fields.char('Password', size=24),
}
@ -992,7 +997,7 @@ class import_sugarcrm(osv.osv):
'email' : True,
'project' : True,
'project_task': True,
'bug': True
'bug': True,
}
def get_key(self, cr, uid, ids, context=None):
@ -1024,7 +1029,9 @@ class import_sugarcrm(osv.osv):
if current.project_task:
key_list.append('Project Tasks')
if current.bug:
key_list.append('Bugs')
key_list.append('Bugs')
if current.attachment:
key_list.append('Notes')
return key_list
def import_all(self, cr, uid, ids, context=None):

View File

@ -25,6 +25,8 @@
<field name= "project_task" />
<field name= "bug" string="Project Issue"/>
</group>
<separator string="" colspan="4"/>
<field name= "attachment" />
<field name="username" invisible="1"/>
<field name="password" invisible="1"/>
</group>

View File

@ -30,7 +30,7 @@ class sugarcrm_login(osv.osv):
_columns = {
'username': fields.char('User Name', size=64, required=True),
'password': fields.char('Password', size=24,required=True),
'url' : fields.char('SugarCRM Path', size=264, required=True, help="Path for SugarCRM connection should be 'http://localhost/sugarcrm/soap.php' Format."),
'url' : fields.char('Service', size=264, required=True, help="Path for SugarCRM connection should be 'http://localhost/sugarcrm/soap.php' Format."),
}
_defaults = {
'username' : 'admin',

View File

@ -10,9 +10,8 @@
<field name="arch" type="xml">
<form string="SugarCRM Login">
<group colspan="4" width="500" >
<separator string="Please Enter Path to Connect with SugarCRM" colspan="4"/>
<separator string="Connection with SugarCRM" colspan="4"/>
<field name="url" colspan="4" widget="url"/>
<separator string="Please enter your user name and password." colspan="4"/>
<field name="username"/>
<newline/>
<field name="password" password="True" />