Skip to content

Commit 3e24887

Browse files
SMaciasOSIetobella
authored andcommitted
[FIX] web_tree_dynamic_colored_field: Fix pre-commit
1 parent ae656ec commit 3e24887

File tree

3 files changed

+27
-23
lines changed

3 files changed

+27
-23
lines changed

web_tree_dynamic_colored_field/README.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ Contributors
163163
- Artem Kostyuk <a.kostyuk@mobilunity.com>
164164
- Guewen Baconnier <guewen.baconnier@camptocamp.com>
165165
- Phuc Tran Thanh <phuc@trobz.com>
166-
- Sylvain LE GAL <https://twitter.com/legalsylvain>
166+
- Sylvain LE GAL
167+
<`https://twitter.com/legalsylvain <https://twitter.com/legalsylvain>`__>
167168
- Jurgis Pralgauskis <jurgis@versada.eu>
168169

169170
Other credits

web_tree_dynamic_colored_field/static/description/index.html

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88

99
/*
1010
:Author: David Goodger (goodger@python.org)
11-
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
11+
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
1212
:Copyright: This stylesheet has been placed in the public domain.
1313
1414
Default cascading style sheet for the HTML output of Docutils.
15+
Despite the name, some widely supported CSS2 features are used.
1516
1617
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
1718
customize this style sheet.
@@ -274,7 +275,7 @@
274275
margin-left: 2em ;
275276
margin-right: 2em }
276277

277-
pre.code .ln { color: grey; } /* line numbers */
278+
pre.code .ln { color: gray; } /* line numbers */
278279
pre.code, code { background-color: #eeeeee }
279280
pre.code .comment, code .comment { color: #5C6576 }
280281
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
@@ -300,7 +301,7 @@
300301
span.pre {
301302
white-space: pre }
302303

303-
span.problematic {
304+
span.problematic, pre.problematic {
304305
color: red }
305306

306307
span.section-subtitle {
@@ -505,7 +506,8 @@ <h1>Contributors</h1>
505506
<li>Artem Kostyuk &lt;<a class="reference external" href="mailto:a.kostyuk&#64;mobilunity.com">a.kostyuk&#64;mobilunity.com</a>&gt;</li>
506507
<li>Guewen Baconnier &lt;<a class="reference external" href="mailto:guewen.baconnier&#64;camptocamp.com">guewen.baconnier&#64;camptocamp.com</a>&gt;</li>
507508
<li>Phuc Tran Thanh &lt;<a class="reference external" href="mailto:phuc&#64;trobz.com">phuc&#64;trobz.com</a>&gt;</li>
508-
<li>Sylvain LE GAL &lt;<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>&gt;</li>
509+
<li>Sylvain LE GAL
510+
&lt;<a class="reference external" href="https://twitter.com/legalsylvain">https://twitter.com/legalsylvain</a>&gt;</li>
509511
<li>Jurgis Pralgauskis &lt;<a class="reference external" href="mailto:jurgis&#64;versada.eu">jurgis&#64;versada.eu</a>&gt;</li>
510512
</ul>
511513
</div>
@@ -520,7 +522,9 @@ <h1>Other credits</h1>
520522
<div class="section" id="maintainers">
521523
<h1>Maintainers</h1>
522524
<p>This module is maintained by the OCA.</p>
523-
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
525+
<a class="reference external image-reference" href="https://odoo-community.org">
526+
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
527+
</a>
524528
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
525529
mission is to support the collaborative development of Odoo features and
526530
promote its widespread use.</p>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @odoo-module **/
22

3-
import {patch} from "@web/core/utils/patch";
43
import {ListRenderer} from "@web/views/list/list_renderer";
54
import {evaluateExpr} from "@web/core/py_js/py";
5+
import {patch} from "@web/core/utils/patch";
66

77
patch(ListRenderer.prototype, "web_tree_dynamic_colored_field_list_renderer", {
88
/**
@@ -11,36 +11,35 @@ patch(ListRenderer.prototype, "web_tree_dynamic_colored_field_list_renderer", {
1111
* @returns {String} style code for the html element
1212
*/
1313
getDynamicColoredStyle(column, record) {
14-
let definition
15-
expression
16-
color
17-
let style = ''
18-
if (column.options){
19-
if (column?.options?.bg_color){
20-
definition = column.options.bg_color
14+
let definition = false;
15+
var expression = false;
16+
var color = false;
17+
let style = "";
18+
var pairList = false;
19+
if (column.options) {
20+
if (column && column.options && column.options.bg_color) {
21+
definition = column.options.bg_color;
2122
for (const color_def of definition.split(";")) {
22-
var pairList = color_def.split(":"),
23-
color = pairList[0],
23+
pairList = color_def.split(":");
24+
color = pairList[0];
2425
expression = pairList[1] ? pairList[1] : "True";
2526
if (evaluateExpr(expression, record.evalContext)) {
2627
style += `background-color: ${color} !important;`;
2728
}
2829
}
2930
}
30-
if (column?.options?.fg_color){
31-
definition = column.options.fg_color
31+
if (column && column.options && column.options.fg_color) {
32+
definition = column.options.fg_color;
3233
for (const color_def of definition.split(";")) {
33-
var pairList = color_def.split(":"),
34-
color = pairList[0],
34+
pairList = color_def.split(":");
35+
color = pairList[0];
3536
expression = pairList[1] ? pairList[1] : "True";
36-
console.log("expression", expression)
3737
if (evaluateExpr(expression, record.evalContext)) {
3838
style += `color: ${color} !important`;
3939
}
4040
}
4141
}
4242
}
43-
return style
43+
return style;
4444
},
45-
4645
});

0 commit comments

Comments
 (0)