mirror of
https://github.com/OCA/web.git
synced 2025-02-22 13:21:25 +02:00
[IMP][web_widget_auto_color] Use render value to allow to use this widget on all type of field
This commit is contained in:
@@ -43,10 +43,9 @@ openerp.web_widget_auto_color = function(instance) {
|
||||
return sum
|
||||
},
|
||||
|
||||
auto_color_cell_style: function(record, column){
|
||||
auto_color_cell_style: function(value){
|
||||
style = ''
|
||||
value = record.get(column.name)
|
||||
if (value != false && value != undefined) {
|
||||
if (value != "" && value != undefined) {
|
||||
var intValue = this.getIntValue(value)
|
||||
bgcolor = this.get_seed_random_color(intValue)
|
||||
fontcolor = this.inverse_color(bgcolor)
|
||||
@@ -57,9 +56,6 @@ openerp.web_widget_auto_color = function(instance) {
|
||||
});
|
||||
|
||||
|
||||
instance.web.form.widgets.add('autocolor', 'instance.web.form.FieldAutoColor');
|
||||
|
||||
instance.web.form.FieldAutoColor = instance.web.form.FieldChar.extend({
|
||||
});
|
||||
instance.web.form.widgets.add('autocolor', 'instance.web.form.AbstractField');
|
||||
|
||||
};
|
||||
@@ -2,7 +2,7 @@
|
||||
<templates id="template" xml:space="preserve">
|
||||
<tr t-extend="ListView.row">
|
||||
<t t-jquery="td[t-att-data-field='column.id']">
|
||||
this.attr('t-att-style', "column.widget =='autocolor' and view.auto_color_cell_style(record, column)")
|
||||
this.attr('t-att-style', "column.widget =='autocolor' and view.auto_color_cell_style(render_cell(record, column))")
|
||||
</t>
|
||||
</tr>
|
||||
</templates>
|
||||
|
||||
Reference in New Issue
Block a user