3
0
Fork 0

remove pyeval class and fixup

17.0
Adrià Gil Sorribes 2019-04-04 15:20:05 +02:00 committed by jurgis
parent 0d0d26d6c3
commit 789aad6eed
1 changed files with 4 additions and 5 deletions

View File

@ -2,7 +2,7 @@ odoo.define('web_tree_dynamic_colored_field', function (require) {
'use strict'; 'use strict';
var ListRenderer = require('web.ListRenderer'); var ListRenderer = require('web.ListRenderer');
var pyeval = require('web.pyeval'); var pyUtils = require("web.py_utils");
ListRenderer.include({ ListRenderer.include({
/** /**
@ -12,8 +12,7 @@ odoo.define('web_tree_dynamic_colored_field', function (require) {
*/ */
_renderBody: function () { _renderBody: function () {
if (this.arch.attrs.colors) { if (this.arch.attrs.colors) {
var colorAttr = this.arch.attrs.colors.split(';') var colorAttr = this.arch.attrs.colors.split(';');
.filter(color >= color.trim().startsWith('color_field'));
if (colorAttr.length > 0) { if (colorAttr.length > 0) {
var colorField = colorAttr[0].split(':')[1].trim(); var colorField = colorAttr[0].split(':')[1].trim();
// validate the presence of that field in tree view // validate the presence of that field in tree view
@ -57,7 +56,7 @@ odoo.define('web_tree_dynamic_colored_field', function (require) {
if (node.tag !== 'field') { return; } if (node.tag !== 'field') { return; }
var nodeOptions = node.attrs.options; var nodeOptions = node.attrs.options;
if (!_.isObject(nodeOptions)) { if (!_.isObject(nodeOptions)) {
nodeOptions = pyeval.py_eval(nodeOptions); nodeOptions = pyUtils.py_eval(nodeOptions);
} }
this.applyColorizeHelper($td, nodeOptions, node, 'fg_color', 'color', ctx); this.applyColorizeHelper($td, nodeOptions, node, 'fg_color', 'color', ctx);
this.applyColorizeHelper($td, nodeOptions, node, 'bg_color', 'background-color', ctx); this.applyColorizeHelper($td, nodeOptions, node, 'bg_color', 'background-color', ctx);
@ -115,7 +114,7 @@ odoo.define('web_tree_dynamic_colored_field', function (require) {
var ctx = _.extend( var ctx = _.extend(
{}, {},
record.data, record.data,
pyeval.context() pyUtils.context()
); );
for (var key in ctx) { for (var key in ctx) {
var value = ctx[key]; var value = ctx[key];