ir_ui_view: parse using lxml.html instead of etree

bzr revid: mat@openerp.com-20130702125916-ahk6jkim08j2voam
This commit is contained in:
Martin Trigaux 2013-07-02 14:59:16 +02:00
parent 1e303767ee
commit 641c4fe784
1 changed files with 4 additions and 3 deletions

View File

@ -28,6 +28,7 @@ import time
from functools import partial
from lxml import etree
from lxml.html import tostring, fromstring
from openerp import tools
from openerp.modules import module
@ -199,10 +200,10 @@ class view(osv.osv):
model_obj = self.pool.get(model)
if xpath:
origin = model_obj.read(cr, uid, [res_id], [field], context=context)[0][field]
origin_tree = etree.fromstring(origin.encode('utf-8'))
origin_tree = fromstring(origin.encode('utf-8'))
zone = origin_tree.xpath(xpath)[0]
zone.getparent().replace(zone, etree.fromstring(value))
value = etree.tostring(origin_tree, encoding='utf-8')
zone.getparent().replace(zone, fromstring(value))
value = tostring(origin_tree, encoding='utf-8')
model_obj.write(cr, uid, res_id, {field: value}, context=context)