summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>2012-04-04 13:00:16 +0530
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>2012-04-04 13:00:16 +0530
commita5f5358cf2f0240852d2fd90d5b9beaafe0e6304 (patch)
tree0945d2376fbe1849221d8437047a1d5c2b05b3d5 /addons/web/static/src/js
parent4229755f81418a3ba34111bc1daf7eb595cdaa15 (diff)
[IMP] improved code for make the list record bold depends on state
bzr revid: tpa@tinyerp.com-20120404073016-ro6wuybho7npp9k4
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/view_editor.js5
-rw-r--r--addons/web/static/src/js/view_list.js11
2 files changed, 12 insertions, 4 deletions
diff --git a/addons/web/static/src/js/view_editor.js b/addons/web/static/src/js/view_editor.js
index 2c0dc3d70b4..e0953ae5ef6 100644
--- a/addons/web/static/src/js/view_editor.js
+++ b/addons/web/static/src/js/view_editor.js
@@ -873,7 +873,8 @@ openerp.web.ViewEditor = openerp.web.OldWidget.extend({
'widget' : {'name':'widget', 'string': 'widget', 'type': 'selection'},
'colors' : {'name':'colors', 'string': 'Colors', 'type': 'char'},
'editable' : {'name':'editable', 'string': 'Editable', 'type': 'selection', 'selection': [["",""],["top","Top"],["bottom", "Bottom"]]},
- 'groups' : {'name':'groups', 'string': 'Groups', 'type': 'selection_multi'}
+ 'groups' : {'name':'groups', 'string': 'Groups', 'type': 'selection_multi'},
+ 'fontbold' : {'name':'fontbold', 'string': 'fontbold', 'type': 'char'},
};
var arch_val = self.get_object_by_id(this.one_object.clicked_tr_id,this.one_object['main_object'], []);
this.edit_node_dialog.$element.append('<table id="rec_table" style="width:400px" class="oe_forms"></table>');
@@ -1149,7 +1150,7 @@ var _PROPERTIES = {
'board': ['style'],
'column' : [],
'action' : ['name', 'string', 'colspan', 'groups'],
- 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows'],
+ 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows', 'fontbold'],
'graph' : ['string', 'type'],
'calendar' : ['string', 'date_start', 'date_stop', 'date_delay', 'day_length', 'color', 'mode']
};
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index e8fff450c6e..cab916bbc32 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -56,6 +56,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
this.view_id = view_id;
this.previous_colspan = null;
this.colors = null;
+ this.fontbold = null;
this.columns = [];
@@ -154,16 +155,21 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
current_date: new Date().toString('yyyy-MM-dd')
// TODO: time, datetime, relativedelta
});
+ var style= '';
+ if(record.attributes.state == this.fontbold) {
+ style = 'font-weight: bold;';
+ }
for(var i=0, len=this.colors.length; i<len; ++i) {
var pair = this.colors[i],
color = pair[0],
expression = pair[1];
if (py.evaluate(expression, context).toJSON()) {
- return 'color: ' + color + ';';
+ style += 'color: ' + color + ';'
+ return style;
}
// TODO: handle evaluation errors
}
- return '';
+ return style;
},
/**
* Called after loading the list view's description, sets up such things
@@ -192,6 +198,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
var self = this;
this.fields_view = data;
this.name = "" + this.fields_view.arch.attrs.string;
+ this.fontbold = this.fields_view.arch.attrs.fontbold
if (this.fields_view.arch.attrs.colors) {
this.colors = _(this.fields_view.arch.attrs.colors.split(';')).chain()