[REM] view.save, move to website module where it belongs

bzr revid: xmo@openerp.com-20130906130905-86ul9efvjt6wo1j2
This commit is contained in:
Xavier Morel
2013-09-06 15:09:05 +02:00
parent 4f6af7f857
commit a61e7b5efa
-18
View File
@@ -25,7 +25,6 @@ import sys
import re
import time
import lxml.html
from lxml import etree
from openerp import tools
@@ -159,23 +158,6 @@ class view(osv.osv):
return super(view, self).write(cr, uid, ids, vals, context)
def save(self, cr, uid, model, res_id, field, value, xpath=None, context=None):
""" Update the content of a field
:param str model:
:param int res_id:
:param str xpath: valid xpath to the tag to replace
"""
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'))
zone = origin_tree.xpath(xpath)[0]
zone.getparent().replace(zone, lxml.html.fromstring(value))
value = etree.tostring(origin_tree, encoding='utf-8')
model_obj.write(cr, uid, res_id, {field: value}, context=context)
# default view selection
def default_view(self, cr, uid, model, view_type, context=None):