diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index c2349fa1932..dcb15d3d16d 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1218,9 +1218,6 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt $('button', doc).each(function() { $(this).attr('data-button-type', $(this).attr('type')).attr('type', 'button'); }); - $('statbutton', doc).each(function() { - $(this).attr('data-button-type', $(this).attr('type')).attr('type', 'button'); - }); // IE's html parser is also a css parser. How convenient... $('board', doc).each(function() { $(this).attr('layout', $(this).attr('style')); @@ -1310,7 +1307,7 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt var tagname = $tag[0].nodeName.toLowerCase(); if (this.tags_registry.contains(tagname)) { this.tags_to_init.push($tag); - return (tagname === 'statbutton') ? this.process_statbutton($tag) : $tag; + return (tagname === 'button') ? this.process_button($tag) : $tag; } var fn = self['process_' + tagname]; if (fn) { @@ -1327,16 +1324,13 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt return $tag; } }, - process_statbutton: function ($button) { + process_button: function ($button) { var self = this; - if ($button.children().length) { - $button.children().each(function() { - self.process($(this)); - }); - } + $button.children().each(function() { + self.process($(this)); + }); return $button; }, - process_widget: function($widget) { this.widgets_to_init.push($widget); return $widget; @@ -1922,6 +1916,8 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ template: 'WidgetButton', init: function(field_manager, node) { node.attrs.type = node.attrs['data-button-type']; + this.is_stat_button = node.attrs.class ? _.include(node.attrs.class.split(' '), 'oe_stat_button') : false; + this.icon = ""; this._super(field_manager, node); this.force_disabled = false; this.string = (this.node.attrs.string || '').replace(/_/g, ''); @@ -2005,22 +2001,6 @@ instance.web.form.WidgetButton = instance.web.form.FormWidget.extend({ } }); -instance.web.form.StatButton = instance.web.form.WidgetButton.extend({ - template: 'StatButton', - - init: function(field_manager, node) { - var icon = node.attrs.icon; - this._super(field_manager, node); - - // debugger; - if (icon) { - this.icon = ""; - } - - }, - -}); - /** * Interface to be implemented by fields. * @@ -2857,7 +2837,7 @@ instance.web.form.FieldPercentPie = instance.web.form.AbstractField.extend({ .donut(true) .showLegend(false) .showLabels(false) - .color(['#DDD','#7C7BAD']) + .color(['#7C7BAD','#DDD']) .donutRatio(0.62); d3.select(svg) @@ -5931,27 +5911,21 @@ instance.web.form.X2ManyCounter = instance.web.form.AbstractField.extend(instanc }); /** - This field can be applied on many2many and one2many. It is a read-only field that will - display a simple string "