From e3c52850a1933c009ef3d2d2fa84a2fc14e10856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 26 Dec 2012 14:40:27 +0100 Subject: [PATCH] Fix header to use string instead of name --- js/view.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/view.js b/js/view.js index 278e4c184e..0204f18a78 100644 --- a/js/view.js +++ b/js/view.js @@ -49,7 +49,7 @@ Sao.View.Tree = Class(Sao.View, { thead.append(tr); this.columns.forEach(function(column) { var th = $('', { - 'text': column.attributes['name'] + 'text': column.attributes['string'] }); tr.append(th); }); @@ -88,6 +88,7 @@ Sao.View.Tree = Class(Sao.View, { var self = this; xml.find('tree').children().each(function(pos, child) { if (child.tagName == 'field') { + var name = child.getAttribute('name'); var attributes = { 'name': child.getAttribute('name'), 'readonly': child.getAttribute('readonly') == 1, @@ -102,6 +103,16 @@ Sao.View.Tree = Class(Sao.View, { 'pre_validate': child.getAttribute('pre_validate') == 1, 'completion': child.getAttribute('completion') == 1 }; + var attribute_names = ['relation', 'domain', 'selection', + 'relation_field', 'string', 'views', 'invisible', + 'add_remove', 'sort', 'context', 'filename']; + for (var i in attribute_names) { + var attr = attribute_names[i]; + if ((attr in model.fields[name].description) && + (child.getAttribute(attr) == null)) { + attributes[attr] = model.fields[name].description[attr]; + } + } var ColumnFactory = Sao.View.tree_column_get( attributes['widget']); var column = new ColumnFactory(model, attributes);