[FIX] htmlentities
bzr revid: tfr@openerp.com-20110713151930-9ndeniexo2waayy3
This commit is contained in:
parent
43e1fa4c54
commit
129787ef18
|
@ -158,7 +158,7 @@ class import_framework(Thread):
|
|||
and each data_i have a external id => in data_id['id']
|
||||
"""
|
||||
if not datas:
|
||||
return (0, 'No data in this table')
|
||||
return (0, 'No data found')
|
||||
mapping['id'] = 'id_new'
|
||||
res = []
|
||||
|
||||
|
@ -460,7 +460,7 @@ class import_framework(Thread):
|
|||
warning = _("with no warning")
|
||||
else:
|
||||
warning = _("with warning : %s") % warning
|
||||
body += _("%s records were imported from table %s, %s \n") % (nb, table, warning)
|
||||
body += _("%s has been successfully imported from %s %s, %s \n") % (nb, self.instance_name, table, warning)
|
||||
return self.get_body_header(result) + "\n\n" + body
|
||||
|
||||
def get_body_header(self, result):
|
||||
|
|
|
@ -26,10 +26,17 @@ from import_base.mapper import *
|
|||
from datetime import datetime
|
||||
import base64
|
||||
import pprint
|
||||
from papyon.service.SOAPService import url_split
|
||||
pp = pprint.PrettyPrinter(indent=4)
|
||||
#copy old import here
|
||||
|
||||
import htmllib
|
||||
|
||||
def unescape_htmlentities(s):
|
||||
p = htmllib.HTMLParser(None)
|
||||
p.save_bgn()
|
||||
p.feed(s)
|
||||
return p.save_end()
|
||||
|
||||
class related_ref(dbmapper):
|
||||
def __init__(self, type):
|
||||
self.type = type
|
||||
|
@ -443,6 +450,7 @@ class sugar_import(import_framework):
|
|||
}
|
||||
|
||||
def import_task(self, val):
|
||||
print val.get('date_start'), val.get('date_due')
|
||||
val['date'] = val.get('date_start') or datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
val['date_deadline'] = val.get('date_due') or datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
|
||||
return val
|
||||
|
@ -933,20 +941,21 @@ class import_sugarcrm(osv.osv):
|
|||
_columns = {
|
||||
'username': fields.char('User Name', size=64, required=True),
|
||||
'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.\
|
||||
'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 & Opp', help="IfLeads & Opp are checked, SugarCRM leads and opportunities data are 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"),
|
||||
'employee': fields.boolean('Employee', help="If Employees is checked, SugarCRM Employees data imported in OpenERP employees form"),
|
||||
'meeting': fields.boolean('Meetings', help="If Meetings is checked, SugarCRM Meetings and Meeting Tasks data imported in OpenERP meetings form"),
|
||||
'call': fields.boolean('Calls', help="If Calls is checked, SugarCRM Calls data imported in OpenERP phonecalls form"),
|
||||
'claim': fields.boolean('Cases', help="If Cases is checked, SugarCRM Cases data imported in OpenERP Claims form"),
|
||||
'email_history': fields.boolean('Email and Note',help="If Email and History is checked, SugarCRM Notes, Attachment and Emails data imported in OpenERP's Related module's History with attachment"),
|
||||
'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"),
|
||||
'document': fields.boolean('Documents', help="If Documents is checked, SugarCRM Documents data imported in OpenERP Document Form"),
|
||||
'user' : fields.boolean('User', help="Check this box to import sugarCRM Users into OpenERP users, warning if a user with the same login exist in OpenERP, user information will be erase by sugarCRM user information", readonly=True),
|
||||
'opportunity': fields.boolean('Leads & Opp', help="Check this box to import sugarCRM Leads and Opportunities into OpenERP Leads and Opportunities"),
|
||||
'contact': fields.boolean('Contacts', help="Check this box to import sugarCRM Contacts into OpenERP addresses"),
|
||||
'account': fields.boolean('Accounts', help="Check this box to import sugarCRM Accounts into OpenERP partners"),
|
||||
'employee': fields.boolean('Employee', help="Check this box to import sugarCRM Employees into OpenERP employees"),
|
||||
'meeting': fields.boolean('Meetings', help="Check this box to import sugarCRM Meetings and Tasks into OpenERP meetings"),
|
||||
'call': fields.boolean('Calls', help="Check this box to import sugarCRM Calls into OpenERP calls"),
|
||||
'claim': fields.boolean('Cases', help="Check this box to import sugarCRM Cases into OpenERP claims"),
|
||||
'email_history': fields.boolean('Email and Note',help="Check this box to import sugarCRM Emails, Notes and Attachments into OpenERP Messages and Attachments"),
|
||||
'project': fields.boolean('Projects', help="Check this box to import sugarCRM Projects into OpenERP projects"),
|
||||
'project_task': fields.boolean('Project Tasks', help="Check this box to import sugarCRM Project Tasks into OpenERP tasks"),
|
||||
'bug': fields.boolean('Bugs', help="Check this box to import sugarCRM Bugs into OpenERP project issues"),
|
||||
'document': fields.boolean('Documents', help="Check this box to import sugarCRM Documents into OpenERP documents"),
|
||||
'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."),
|
||||
}
|
||||
|
@ -971,6 +980,7 @@ class import_sugarcrm(osv.osv):
|
|||
return self._module_installed(cr,uid,'hr',context=context)
|
||||
|
||||
_defaults = {#to be set to true, but easier for debugging
|
||||
'user' : True,
|
||||
'opportunity': True,
|
||||
'contact' : True,
|
||||
'account' : True,
|
||||
|
@ -1035,6 +1045,8 @@ class import_sugarcrm(osv.osv):
|
|||
module = {}
|
||||
for current in self.browse(cr, uid, ids, context):
|
||||
context.update({'username': current.username, 'password': current.password, 'url': current.url, 'email_user': current.email_from or False, 'instance_name': current.instance_name or False})
|
||||
if current.user:
|
||||
key_list.append('Users')
|
||||
if current.contact:
|
||||
key_list.append('Contacts')
|
||||
if current.account:
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<label colspan="2" string="" />
|
||||
<label colspan="2" string="Use the SugarSoap API URL (read tooltip) and a full access SugarCRM login."/>
|
||||
<label colspan="2" string="" />
|
||||
<label colspan="2" string="Choose data you want to import. Click 'Import' to get data manually or 'Schedule Reccurent Import' to get recurrently and automatically data."/>
|
||||
<label colspan="2" string="Choose data you want to import. Click 'Import' to get data manually or 'Schedule Reccurent Imports' to get recurrently and automatically data."/>
|
||||
<label colspan="2" string="" />
|
||||
<label colspan="2" string="If you make recurrent or ponctual import, data already in OpenERP will be updated by SugarCRM data."/>
|
||||
<label colspan="2" string="" />
|
||||
|
@ -36,6 +36,7 @@
|
|||
<group colspan="4" col="6">
|
||||
<group colspan="1" col="2">
|
||||
<separator string="Address Book" colspan="4"/>
|
||||
<field name="user" />
|
||||
<field name= "account" />
|
||||
<field name= "contact" />
|
||||
</group>
|
||||
|
@ -74,7 +75,7 @@
|
|||
<group colspan="4" col="6">
|
||||
<label string="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="_Cancel"/>
|
||||
<button name="import_from_scheduler_all" groups="base.group_extended" string="_Schedule Recurrent Import"
|
||||
<button name="import_from_scheduler_all" groups="base.group_extended" string="_Schedule Recurrent Imports"
|
||||
type="object" icon="gtk-execute" />
|
||||
<button name="import_all" string="_Import"
|
||||
type="object" icon="terp-camera_test"/>
|
||||
|
|
|
@ -28,6 +28,7 @@ from tools.translate import _
|
|||
import base64
|
||||
from lxml import etree
|
||||
import tools
|
||||
import import_sugarcrm
|
||||
|
||||
|
||||
|
||||
|
@ -161,7 +162,7 @@ def search(portType, sessionid, module_name, offset, max_results, query=None, or
|
|||
for i in list:
|
||||
ans_dir = {}
|
||||
for j in i._name_value_list:
|
||||
ans_dir[tools.ustr(j._name)] = tools.ustr(j._value)
|
||||
ans_dir[tools.ustr(j._name)] = import_sugarcrm.unescape_htmlentities(tools.ustr(j._value))
|
||||
#end for
|
||||
ans_list.append(ans_dir)
|
||||
#end for
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Import Message">
|
||||
<label colspan="4" nolabel="1" string="Data are importing, the process is running in the background, You will receive an email at the end of the import."/>
|
||||
<label colspan="4" nolabel="1" string="Data are importing, the process is running in the background, you will receive an email at the end of the import."/>
|
||||
<separator string="" colspan="4" />
|
||||
<button icon="gtk-ok" special="cancel" string="_Ok"/>
|
||||
</form>
|
||||
|
|
Loading…
Reference in New Issue