mirror of https://github.com/OCA/web.git
[IMP] web_tree_dynamic_colored_field: black, isort, prettier
parent
8215e53fe0
commit
a4b80ed041
|
@ -1,4 +1,4 @@
|
||||||
odoo.define("web_tree_dynamic_colored_field", function(require) {
|
odoo.define("web_tree_dynamic_colored_field", function (require) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var ListRenderer = require("web.ListRenderer");
|
var ListRenderer = require("web.ListRenderer");
|
||||||
|
@ -11,7 +11,7 @@ odoo.define("web_tree_dynamic_colored_field", function(require) {
|
||||||
*
|
*
|
||||||
* @override
|
* @override
|
||||||
*/
|
*/
|
||||||
_renderBodyCell: function(record, node) {
|
_renderBodyCell: function (record, node) {
|
||||||
var $td = this._super.apply(this, arguments);
|
var $td = this._super.apply(this, arguments);
|
||||||
var ctx = this.getEvalContext(record);
|
var ctx = this.getEvalContext(record);
|
||||||
this.applyColorize($td, record, node, ctx);
|
this.applyColorize($td, record, node, ctx);
|
||||||
|
@ -26,7 +26,7 @@ odoo.define("web_tree_dynamic_colored_field", function(require) {
|
||||||
* @param {Object} node an XML node (must be a <field>)
|
* @param {Object} node an XML node (must be a <field>)
|
||||||
* @param {Object} ctx evaluation context for the record
|
* @param {Object} ctx evaluation context for the record
|
||||||
*/
|
*/
|
||||||
applyColorize: function($td, record, node, ctx) {
|
applyColorize: function ($td, record, node, ctx) {
|
||||||
if (!node.attrs.options) {
|
if (!node.attrs.options) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ odoo.define("web_tree_dynamic_colored_field", function(require) {
|
||||||
* @param {String} cssAttribute a real CSS-compatible attribute
|
* @param {String} cssAttribute a real CSS-compatible attribute
|
||||||
* @param {Object} ctx evaluation context for the record
|
* @param {Object} ctx evaluation context for the record
|
||||||
*/
|
*/
|
||||||
applyColorizeHelper: function(
|
applyColorizeHelper: function (
|
||||||
$td,
|
$td,
|
||||||
nodeOptions,
|
nodeOptions,
|
||||||
node,
|
node,
|
||||||
|
@ -90,7 +90,7 @@ odoo.define("web_tree_dynamic_colored_field", function(require) {
|
||||||
* @returns {Array} undefined or array of color, parsed expression,
|
* @returns {Array} undefined or array of color, parsed expression,
|
||||||
* original expression
|
* original expression
|
||||||
*/
|
*/
|
||||||
pairColors: function(pairColor) {
|
pairColors: function (pairColor) {
|
||||||
if (pairColor !== "") {
|
if (pairColor !== "") {
|
||||||
var pairList = pairColor.split(":"),
|
var pairList = pairColor.split(":"),
|
||||||
color = pairList[0],
|
color = pairList[0],
|
||||||
|
@ -108,7 +108,7 @@ odoo.define("web_tree_dynamic_colored_field", function(require) {
|
||||||
* @param {Object} record a record to build a context from
|
* @param {Object} record a record to build a context from
|
||||||
* @returns {Object} evaluation context for the record
|
* @returns {Object} evaluation context for the record
|
||||||
*/
|
*/
|
||||||
getEvalContext: function(record) {
|
getEvalContext: function (record) {
|
||||||
var ctx = _.extend({}, record.data, pyUtils.context());
|
var ctx = _.extend({}, record.data, pyUtils.context());
|
||||||
for (var key in ctx) {
|
for (var key in ctx) {
|
||||||
var value = ctx[key];
|
var value = ctx[key];
|
||||||
|
|
Loading…
Reference in New Issue