[IMP] merging vmt improvements rng

bzr revid: fp@tinyerp.com-20120604183209-0gszmur74yck4smr
This commit is contained in:
Fabien Pinckaers 2012-06-04 20:32:09 +02:00
commit 1ff3352c79
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

@ -26,7 +26,6 @@
<header>
<button name="action_next" icon="gtk-go-forward"
type="object" string="Continue"/>
</header>
<field name="note"/>
</form>