[IMP] rng validation: remove call to rng validation, replace it with calls to fields_view_get.

bzr revid: vmt@openerp.com-20120604160124-uz4q4aim6sl9wckm
This commit is contained in:
Vo Minh Thu 2012-06-04 18:01:24 +02:00
parent deb9992ca8
commit d2252dba05
3 changed files with 19 additions and 3 deletions

View File

@ -74,10 +74,26 @@ class view(osv.osv):
_order = "priority,name"
def _check_xml(self, cr, uid, ids, context=None):
def root_view(record):
if not record.inherit_id:
return record
else:
parent = self.browse(cr, uid, record.inherit_id.id, context)
return root_view(parent)
def call_view(record):
try:
root = root_view(record)
self.pool.get(root.model).fields_view_get(cr, uid, view_id=root.id, view_type=root.type, context=context)
return True
except:
_logger.exception("Can't obtain view description for model: %s (view id: %s).", record.model, record.id)
return False
for view in self.browse(cr, uid, ids, context):
return call_view(view)
# TODO The following code should be executed (i.e. no early return above).
# TODO The view.rng file can be read only once!
eview = etree.fromstring(view.arch.encode('utf8'))
if eview.get('layout') or eview.get('validate'):
continue
frng = tools.file_open(os.path.join('base','rng','view.rng'))
try:
relaxng_doc = etree.parse(frng)

View File

@ -38,6 +38,7 @@ class base_module_upgrade(osv.osv_memory):
if view_type != 'form':
return res
context = {} if context is None else context
record_id = context and context.get('active_id', False) or False
active_model = context.get('active_model')
if (not record_id) or (not active_model):

View File

@ -41,7 +41,6 @@
<group>
<field name="note" nolabel="1" colspan="4" width="500"/>
<group colspan="4" col="8">
<field name="progress" widget="progressbar"/>
<label string="" colspan="4"/>
<group colspan="1" col="2">
<button name="action_next" icon="gtk-go-forward"