diff options
| author | Arthur Maniet <arthurmaniet@me.com> | 2015-02-04 13:45:19 +0100 |
|---|---|---|
| committer | Xavier Morel <xmo@odoo.com> | 2015-02-05 13:08:15 +0100 |
| commit | f0cefa72325cabcd2bff1952816a84a380dc6e2f (patch) | |
| tree | 0d11938b1c0376d6085e234df522d67879dc43db /addons/web/static/src/js/view_list.js | |
| parent | 691254cbfe0d4c64762d2d1c2c5e3b0ad2c5423b (diff) | |
[ADD] py.js: len() and truthiness on lists, tuples and dicts
* use new support to colorize reconciled bank statement lines
* fixes tokenization of ``is not`` to not blow up on ``not foo``
* improves calling code to get truthiness of evaluated expression
instead of truthiness of javascript-equivalent objects: an empty list
is falsy in Python but truthy in javascript, since the evaluated
expression is in Python one would expect Python truthiness rules
without having to manually convert to boolean
closes #5070
Diffstat (limited to 'addons/web/static/src/js/view_list.js')
| -rw-r--r-- | addons/web/static/src/js/view_list.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 0e446fb323e..135f73d2ce2 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -182,7 +182,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi pair = this.fonts[i]; var font = pair[0]; expression = pair[1]; - if (py.evaluate(expression, context).toJSON()) { + if (py.PY_isTrue(py.evaluate(expression, context))) { switch(font) { case 'bold': style += 'font-weight: bold;'; @@ -203,7 +203,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi pair = this.colors[i]; var color = pair[0]; expression = pair[1]; - if (py.evaluate(expression, context).toJSON()) { + if (py.PY_isTrue(py.evaluate(expression, context))) { return style += 'color: ' + color + ';'; } // TODO: handle evaluation errors |
