diff --git a/addons/web/static/src/js/view_editor.js b/addons/web/static/src/js/view_editor.js index 59d1fed9345..6a14c0ef7f9 100644 --- a/addons/web/static/src/js/view_editor.js +++ b/addons/web/static/src/js/view_editor.js @@ -873,7 +873,8 @@ instance.web.ViewEditor = instance.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'}, + 'fonts' : {'name':'fonts', 'string': 'fonts', '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('
'); @@ -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', 'fonts'], '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 c29957cac2d..1fa3ca4fcee 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -56,6 +56,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.view_id = view_id; this.previous_colspan = null; this.colors = null; + this.fonts = null; this.columns = []; @@ -140,29 +141,53 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi return this.reload_view(null, null, true); }, /** - * Returns the color for the provided record in the current view (from the - * ``@colors`` attribute) + * Returns the style for the provided record in the current view (from the + * ``@colors`` and ``@fonts`` attributes) * * @param {Record} record record for the current row - * @returns {String} CSS color declaration + * @returns {String} CSS style declaration */ - color_for: function (record) { - if (!this.colors) { return ''; } + style_for: function (record) { + var style= ''; + var context = _.extend({}, record.attributes, { uid: this.session.uid, current_date: new Date().toString('yyyy-MM-dd') // TODO: time, datetime, relativedelta }); + + if (this.fonts) { + for(var i=0, len=this.fonts.length; i + t-att-style="view.style_for(record)">