diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index b0dbb55bd51..623fef0662f 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -600,7 +600,7 @@ - + diff --git a/addons/account_bank_statement_extensions/account_bank_statement_view.xml b/addons/account_bank_statement_extensions/account_bank_statement_view.xml index f0796b4631d..d546c49f6b1 100644 --- a/addons/account_bank_statement_extensions/account_bank_statement_view.xml +++ b/addons/account_bank_statement_extensions/account_bank_statement_view.xml @@ -57,7 +57,7 @@ bank.statement.line.list account.bank.statement.line - + diff --git a/addons/l10n_be_coda/l10n_be_coda_view.xml b/addons/l10n_be_coda/l10n_be_coda_view.xml index 6983bc15790..079b63d643b 100644 --- a/addons/l10n_be_coda/l10n_be_coda_view.xml +++ b/addons/l10n_be_coda/l10n_be_coda_view.xml @@ -38,7 +38,7 @@ account.bank.statement.line 10 - + @@ -86,4 +86,4 @@ - \ No newline at end of file + diff --git a/addons/web/static/lib/py.js/README.rst b/addons/web/static/lib/py.js/README.rst index 7601318df6d..5380f3e6c8f 100644 --- a/addons/web/static/lib/py.js/README.rst +++ b/addons/web/static/lib/py.js/README.rst @@ -53,7 +53,7 @@ Builtins Same as tuple (``list`` is currently an alias for ``tuple``) ``dict`` - Implements trivial getting and setting, nothing beyond that. + Implements trivial getting, setting and len, nothing beyond that. Note that most methods are probably missing from all of these. diff --git a/addons/web/static/lib/py.js/TODO.rst b/addons/web/static/lib/py.js/TODO.rst index a1309bd3fc5..dd3237e3572 100644 --- a/addons/web/static/lib/py.js/TODO.rst +++ b/addons/web/static/lib/py.js/TODO.rst @@ -35,7 +35,6 @@ Base methods requirement * ``__getattr__`` * ``dict.get`` -* ``__len__`` In datamodel, not implemented in any type, untested *************************************************** diff --git a/addons/web/static/lib/py.js/lib/py.js b/addons/web/static/lib/py.js/lib/py.js index 2c738dc95d1..2c6c832f9fe 100644 --- a/addons/web/static/lib/py.js/lib/py.js +++ b/addons/web/static/lib/py.js/lib/py.js @@ -320,7 +320,7 @@ var py = {}; if (token === 'in' && tokens[tokens.length-1].id === 'not') { symbol = symbols['not in']; tokens.pop(); - } else if (token === 'not' && tokens[tokens.length-1].id === 'is') { + } else if (token === 'not' && tokens.length > 0 && tokens[tokens.length-1].id === 'is') { symbol = symbols['is not']; tokens.pop(); } else { @@ -969,6 +969,12 @@ var py = {}; __init__: function () { this._values = []; }, + __len__: function () { + return this._values.length; + }, + __nonzero__: function () { + return py.PY_size(this) > 0 ? py.True : py.False; + }, __contains__: function (value) { for(var i=0, len=this._values.length; i 0 ? py.True : py.False; + }, get: function () { var args = py.PY_parseArgs(arguments, ['k', ['d', py.None]]); var h = args.k.__hash__(); 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 diff --git a/addons/web/static/src/js/view_tree.js b/addons/web/static/src/js/view_tree.js index aac7198f2c3..45cc183511a 100644 --- a/addons/web/static/src/js/view_tree.js +++ b/addons/web/static/src/js/view_tree.js @@ -145,7 +145,7 @@ instance.web.TreeView = instance.web.View.extend(/** @lends instance.web.TreeVie var pair = this.colors[i], color = pair[0], expression = pair[1]; - if (py.evaluate(expression, context).toJSON()) { + if (py.PY_isTrue(py.evaluate(expression, context))) { return 'color: ' + color + ';'; } // TODO: handle evaluation errors