diff --git a/addons/web/doc/async.rst b/addons/web/doc/async.rst index 23b3409bd8f..bd23d5a31d3 100644 --- a/addons/web/doc/async.rst +++ b/addons/web/doc/async.rst @@ -1,5 +1,5 @@ -Don't stop the world now: asynchronous development and Javascript -================================================================= +Asynchronous Operations +======================= As a language (and runtime), javascript is fundamentally single-threaded. This means any blocking request or computation will diff --git a/addons/web/doc/changelog-7.0.rst b/addons/web/doc/changelog-7.0.rst index dd08f1bcde7..b801c11b945 100644 --- a/addons/web/doc/changelog-7.0.rst +++ b/addons/web/doc/changelog-7.0.rst @@ -95,8 +95,8 @@ DataGroup -> also Model ----------------------- Alongside the deprecation of ``DataSet`` for -:js:class:`~openerp.web.Model`, OpenERP Web 7.0 also deprecates -``DataGroup`` and its subtypes in favor of a single method on +:js:class:`~openerp.web.Model`, OpenERP Web 7.0 removes +``DataGroup`` and its subtypes as public objects in favor of a single method on :js:class:`~openerp.web.Query`: :js:func:`~openerp.web.Query.group_by`. @@ -116,3 +116,8 @@ Because it is heavily related to ``DataSet`` (as it *yields* ``DataGroup`` (if we want to stay consistent), which is a good time to make the API more imperative and look more like what most developers are used to. + +But as ``DataGroup`` users in 6.1 were rare (and there really was little reason +to use it), it has been removed as a public API. + + diff --git a/addons/web/doc/rpc.rst b/addons/web/doc/rpc.rst index 4787978e187..db6fcb4fa4b 100644 --- a/addons/web/doc/rpc.rst +++ b/addons/web/doc/rpc.rst @@ -1,5 +1,5 @@ -Outside the box: network interactions -===================================== +RPC Calls +========= Building static displays is all nice and good and allows for neat effects (and sometimes you're given data to display from third parties diff --git a/addons/web/i18n/ar.po b/addons/web/i18n/ar.po index 008f1d300d6..40756b45f6b 100644 --- a/addons/web/i18n/ar.po +++ b/addons/web/i18n/ar.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/bg.po b/addons/web/i18n/bg.po index e8b2d251e5d..d1ab853401a 100644 --- a/addons/web/i18n/bg.po +++ b/addons/web/i18n/bg.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/bn.po b/addons/web/i18n/bn.po index be55c854683..8b6accef4ac 100644 --- a/addons/web/i18n/bn.po +++ b/addons/web/i18n/bn.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/bs.po b/addons/web/i18n/bs.po index 9c4c8e1efea..e784c56a4fb 100644 --- a/addons/web/i18n/bs.po +++ b/addons/web/i18n/bs.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/ca.po b/addons/web/i18n/ca.po index d5377f66780..be31ecde6e8 100644 --- a/addons/web/i18n/ca.po +++ b/addons/web/i18n/ca.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/cs.po b/addons/web/i18n/cs.po index 1bc447a369e..2a580dfb6f1 100644 --- a/addons/web/i18n/cs.po +++ b/addons/web/i18n/cs.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" "X-Poedit-Language: Czech\n" #. openerp-web diff --git a/addons/web/i18n/da.po b/addons/web/i18n/da.po index 8799ce9472e..9ed2c394c67 100644 --- a/addons/web/i18n/da.po +++ b/addons/web/i18n/da.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/de.po b/addons/web/i18n/de.po index 3d1ff84113d..efffdaae086 100644 --- a/addons/web/i18n/de.po +++ b/addons/web/i18n/de.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/en_AU.po b/addons/web/i18n/en_AU.po index 833184dc94f..523091548a1 100644 --- a/addons/web/i18n/en_AU.po +++ b/addons/web/i18n/en_AU.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/en_GB.po b/addons/web/i18n/en_GB.po index d68113dbbac..eed11630b31 100644 --- a/addons/web/i18n/en_GB.po +++ b/addons/web/i18n/en_GB.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/es.po b/addons/web/i18n/es.po index e11bb829ba0..eb8d94b563c 100644 --- a/addons/web/i18n/es.po +++ b/addons/web/i18n/es.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/es_CL.po b/addons/web/i18n/es_CL.po index ef34d06b874..3888b799e52 100644 --- a/addons/web/i18n/es_CL.po +++ b/addons/web/i18n/es_CL.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/es_CR.po b/addons/web/i18n/es_CR.po index cb0bb1202e2..a3c9e0ea3f5 100644 --- a/addons/web/i18n/es_CR.po +++ b/addons/web/i18n/es_CR.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:28+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" "Language: es\n" #. openerp-web diff --git a/addons/web/i18n/es_EC.po b/addons/web/i18n/es_EC.po index d4ff6f80109..89aa15aa3f5 100644 --- a/addons/web/i18n/es_EC.po +++ b/addons/web/i18n/es_EC.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:28+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/et.po b/addons/web/i18n/et.po index 2422f46fc89..a664a0eba71 100644 --- a/addons/web/i18n/et.po +++ b/addons/web/i18n/et.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/eu.po b/addons/web/i18n/eu.po index 99debdd072d..ae886ab0b86 100644 --- a/addons/web/i18n/eu.po +++ b/addons/web/i18n/eu.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/fi.po b/addons/web/i18n/fi.po index 43dbcdd8e18..e97a9cedfac 100644 --- a/addons/web/i18n/fi.po +++ b/addons/web/i18n/fi.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/fr.po b/addons/web/i18n/fr.po index 619b8465dc5..036d1695bc4 100644 --- a/addons/web/i18n/fr.po +++ b/addons/web/i18n/fr.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/fr_CA.po b/addons/web/i18n/fr_CA.po index 0f2cd756705..070e109a1ac 100644 --- a/addons/web/i18n/fr_CA.po +++ b/addons/web/i18n/fr_CA.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/gl.po b/addons/web/i18n/gl.po index 42d4e312372..6d3c4af4df7 100644 --- a/addons/web/i18n/gl.po +++ b/addons/web/i18n/gl.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/gu.po b/addons/web/i18n/gu.po index 1d2f403e0db..851593765c3 100644 --- a/addons/web/i18n/gu.po +++ b/addons/web/i18n/gu.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/hi.po b/addons/web/i18n/hi.po index 61b77e546c8..5e95732337f 100644 --- a/addons/web/i18n/hi.po +++ b/addons/web/i18n/hi.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/hr.po b/addons/web/i18n/hr.po index 3aadcd86171..47f2a6cb7ef 100644 --- a/addons/web/i18n/hr.po +++ b/addons/web/i18n/hr.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/hu.po b/addons/web/i18n/hu.po index 691445417da..35722b9be95 100644 --- a/addons/web/i18n/hu.po +++ b/addons/web/i18n/hu.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/id.po b/addons/web/i18n/id.po index cf59fe32dba..4f5ff9a5b44 100644 --- a/addons/web/i18n/id.po +++ b/addons/web/i18n/id.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/it.po b/addons/web/i18n/it.po index 0ef8452b271..402ddad3365 100644 --- a/addons/web/i18n/it.po +++ b/addons/web/i18n/it.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/ja.po b/addons/web/i18n/ja.po index 699f55c1311..6fd63587a64 100644 --- a/addons/web/i18n/ja.po +++ b/addons/web/i18n/ja.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/ka.po b/addons/web/i18n/ka.po index 6798dca15c9..09c4ffd9f8b 100644 --- a/addons/web/i18n/ka.po +++ b/addons/web/i18n/ka.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/mk.po b/addons/web/i18n/mk.po index 613176f1c3c..9003b875eac 100644 --- a/addons/web/i18n/mk.po +++ b/addons/web/i18n/mk.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/mn.po b/addons/web/i18n/mn.po index 58e8f985aec..072448c126d 100644 --- a/addons/web/i18n/mn.po +++ b/addons/web/i18n/mn.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/nb.po b/addons/web/i18n/nb.po index 0a82c8e5e39..275a678b617 100644 --- a/addons/web/i18n/nb.po +++ b/addons/web/i18n/nb.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/nl.po b/addons/web/i18n/nl.po index a99e02aeb7a..e23fe40a79b 100644 --- a/addons/web/i18n/nl.po +++ b/addons/web/i18n/nl.po @@ -9,13 +9,13 @@ msgstr "" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2012-07-02 09:06+0200\n" "PO-Revision-Date: 2012-07-02 14:46+0000\n" -"Last-Translator: Erwin \n" +"Last-Translator: Erwin van der Ploeg (Endian Solutions) \n" "Language-Team: Dutch \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/nl_BE.po b/addons/web/i18n/nl_BE.po index cdf0bbdcee2..d7006b509a2 100644 --- a/addons/web/i18n/nl_BE.po +++ b/addons/web/i18n/nl_BE.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/pl.po b/addons/web/i18n/pl.po index 8881a0bc239..7a90d6d5432 100644 --- a/addons/web/i18n/pl.po +++ b/addons/web/i18n/pl.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/pt.po b/addons/web/i18n/pt.po index 43b6d330612..d4fd51fa982 100644 --- a/addons/web/i18n/pt.po +++ b/addons/web/i18n/pt.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/pt_BR.po b/addons/web/i18n/pt_BR.po index 041c1d859d0..735c8f9feef 100644 --- a/addons/web/i18n/pt_BR.po +++ b/addons/web/i18n/pt_BR.po @@ -15,8 +15,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/ro.po b/addons/web/i18n/ro.po index ec52b3807e8..71c7cb15c58 100644 --- a/addons/web/i18n/ro.po +++ b/addons/web/i18n/ro.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/ru.po b/addons/web/i18n/ru.po index 6ed05f29c2a..a83821b5e5f 100644 --- a/addons/web/i18n/ru.po +++ b/addons/web/i18n/ru.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/sk.po b/addons/web/i18n/sk.po index 5656d604668..6a2165efaf9 100644 --- a/addons/web/i18n/sk.po +++ b/addons/web/i18n/sk.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/sl.po b/addons/web/i18n/sl.po index d228cd9651e..a869b97eab4 100644 --- a/addons/web/i18n/sl.po +++ b/addons/web/i18n/sl.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/sq.po b/addons/web/i18n/sq.po index c77bd50961a..3b5e2ca41ea 100644 --- a/addons/web/i18n/sq.po +++ b/addons/web/i18n/sq.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:48+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/sr@latin.po b/addons/web/i18n/sr@latin.po index c0e6c7f6207..2c35afc3bde 100644 --- a/addons/web/i18n/sr@latin.po +++ b/addons/web/i18n/sr@latin.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:28+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/sv.po b/addons/web/i18n/sv.po index 1c5823e8041..978e4fb1fb3 100644 --- a/addons/web/i18n/sv.po +++ b/addons/web/i18n/sv.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/tr.po b/addons/web/i18n/tr.po index 2322b869344..7a74eba5dd0 100644 --- a/addons/web/i18n/tr.po +++ b/addons/web/i18n/tr.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/uk.po b/addons/web/i18n/uk.po index e45cf1dca3a..daed408aaaf 100644 --- a/addons/web/i18n/uk.po +++ b/addons/web/i18n/uk.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:27+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/zh_CN.po b/addons/web/i18n/zh_CN.po index 550ec9dc897..7539b136e03 100644 --- a/addons/web/i18n/zh_CN.po +++ b/addons/web/i18n/zh_CN.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:28+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/i18n/zh_TW.po b/addons/web/i18n/zh_TW.po index 0bdd2804510..f29b9002d8c 100644 --- a/addons/web/i18n/zh_TW.po +++ b/addons/web/i18n/zh_TW.po @@ -14,8 +14,8 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2012-10-03 05:28+0000\n" -"X-Generator: Launchpad (build 16061)\n" +"X-Launchpad-Export-Date: 2012-10-13 04:49+0000\n" +"X-Generator: Launchpad (build 16137)\n" #. openerp-web #: addons/web/static/src/js/chrome.js:176 diff --git a/addons/web/static/lib/datejs/globalization/ab-RU.js b/addons/web/static/lib/datejs/globalization/ab-RU.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/ar-AR.js b/addons/web/static/lib/datejs/globalization/ar-AR.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/bs-BS.js b/addons/web/static/lib/datejs/globalization/bs-BS.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/iu-CA.js b/addons/web/static/lib/datejs/globalization/iu-CA.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/ko-KP.js b/addons/web/static/lib/datejs/globalization/ko-KP.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/ml-IN.js b/addons/web/static/lib/datejs/globalization/ml-IN.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/oc-FR.js b/addons/web/static/lib/datejs/globalization/oc-FR.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/si-LK.js b/addons/web/static/lib/datejs/globalization/si-LK.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/sr-RS.js b/addons/web/static/lib/datejs/globalization/sr-RS.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/sr@latin.js b/addons/web/static/lib/datejs/globalization/sr@latin.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/lib/datejs/globalization/tlh-TLH.js b/addons/web/static/lib/datejs/globalization/tlh-TLH.js new file mode 100644 index 00000000000..e69de29bb2d diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index c8f1567bee9..8925c3a0964 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -25,6 +25,7 @@ display: none !important; } } + .openerp.openerp_webclient_container { height: 100%; position: relative; @@ -1184,7 +1185,7 @@ color: white; padding: 2px 4px; margin: 1px 6px 0 0; - border: 1px solid lightgrey; + border: 1px solid lightGray; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-border-radius: 4px; -webkit-border-radius: 4px; @@ -1209,7 +1210,7 @@ transform: scale(1.1); } .openerp .oe_secondary_submenu .oe_active { - border-top: 1px solid lightgrey; + border-top: 1px solid lightGray; border-bottom: 1px solid #dedede; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2); -moz-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2), inset 0 -1px 3px rgba(40, 40, 40, 0.2); @@ -2054,36 +2055,36 @@ width: 400px; padding-bottom: 0; } -.openerp .oe_form header .oe_tags div.oe_chatter { +.openerp .oe_form div.oe_chatter { min-width: 650px; max-width: 860px; margin: 0 auto; padding: 16px 0 48px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration p, .openerp .oe_form header .oe_tags div.oe_form_configuration ul, .openerp .oe_form header .oe_tags div.oe_form_configuration ol { +.openerp .oe_form div.oe_form_configuration p, .openerp .oe_form div.oe_form_configuration ul, .openerp .oe_form div.oe_form_configuration ol { color: #aaaaaa; max-width: 650px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration label { +.openerp .oe_form div.oe_form_configuration label { min-width: 150px; } -.openerp .oe_form header .oe_tags div.oe_form_configuration .oe_form_group_cell_label { +.openerp .oe_form div.oe_form_configuration .oe_form_group_cell_label { padding: 1px 0; } -.openerp .oe_form header .oe_tags div.oe_form_configuration .oe_form_group_cell div div { +.openerp .oe_form div.oe_form_configuration .oe_form_group_cell div div { padding: 1px 0; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer { +.openerp .oe_form .oe_subtotal_footer { width: 1% !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer td.oe_form_group_cell { +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell { text-align: right; padding: 0 !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer td.oe_form_group_cell_label { +.openerp .oe_form .oe_subtotal_footer td.oe_form_group_cell_label { border-right: none; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer .oe_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer .oe_subtotal_footer_separator { width: 108px; border-top: 1px solid #cacaca; margin-top: 4px; @@ -2091,14 +2092,14 @@ font-weight: bold; font-size: 18px; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label:after { +.openerp .oe_form .oe_subtotal_footer label:after { content: ":"; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label.oe_subtotal_footer_separator { +.openerp .oe_form .oe_subtotal_footer label.oe_subtotal_footer_separator { font-weight: bold !important; padding: 2px 11px 2px 0px !important; } -.openerp .oe_form header .oe_tags .oe_subtotal_footer label.oe_form_label_help { +.openerp .oe_form .oe_subtotal_footer label.oe_form_label_help { font-weight: normal; } .openerp .oe_form .oe_form_button { @@ -2130,7 +2131,7 @@ } .openerp .oe_form .oe_form_label_help[for] span, .openerp .oe_form .oe_form_label[for] span { font-size: 80%; - color: darkgreen; + color: darkGreen; vertical-align: top; position: relative; top: -4px; diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 823ced4e24f..a1adfe67e75 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1616,16 +1616,18 @@ $sheet-max-width: 860px ul display: inline-block float: right - .oe_button, + .oe_button margin: 3px 2px 1px &:first-child margin-left: 6px // }}} // FormView.custom tags and classes {{{ - .oe_form header .oe_tags - margin: 5px 0 0 5px - width: 400px - padding-bottom: 0 + .oe_form + header + .oe_tags + margin: 5px 0 0 5px + width: 400px + padding-bottom: 0 div.oe_chatter min-width: 650px max-width: $sheet-max-width diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index b605f4ad4e1..3cb4437d1c3 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -70,7 +70,9 @@ instance.web.Dialog = instance.web.Widget.extend({ autoOpen: false, position: [false, 40], buttons: {}, - beforeClose: function () { self.on_close(); }, + beforeClose: function () { + self.trigger("closing"); + }, resizeStop: this.on_resized }; for (var f in this) { @@ -84,6 +86,7 @@ instance.web.Dialog = instance.web.Widget.extend({ } _.extend(this.dialog_options, options); } + this.on("closing", this, this._closing); }, get_options: function(options) { var self = this, @@ -126,13 +129,10 @@ instance.web.Dialog = instance.web.Widget.extend({ if (! this.dialog_inited) this.init_dialog(); var o = this.get_options(options); - if (! this.params_buttons) { - this.$buttons.appendTo($("body")); - } + this.$buttons.appendTo($("body")); instance.web.dialog(this.$el, o).dialog('open'); - if (! this.params_buttons) { - this.$buttons.appendTo(this.$el.dialog("widget")); - } + this.$el.dialog("widget").find(".ui-dialog-buttonpane").remove(); + this.$buttons.appendTo(this.$el.dialog("widget")); if (o.height === 'auto' && o.max_height) { this.$el.css({ 'max-height': o.max_height, 'overflow-y': 'auto' }); } @@ -145,6 +145,8 @@ instance.web.Dialog = instance.web.Widget.extend({ if (! this.params_buttons) { this.$buttons = $('
'); this.$el.dialog("widget").append(this.$buttons); + } else { + this.$buttons = this.$el.dialog("widget").find(".ui-dialog-buttonpane"); } this.dialog_inited = true; var res = this.start(); @@ -153,7 +155,7 @@ instance.web.Dialog = instance.web.Widget.extend({ close: function() { this.$el.dialog('close'); }, - on_close: function() { + _closing: function() { if (this.__tmp_dialog_destroying) return; if (this.dialog_options.destroy_on_close) { @@ -627,6 +629,7 @@ instance.web.Reload = function(parent, params) { hash = "#menu_id=" + menu_id; } var url = l.protocol + "//" + l.host + l.pathname + search + hash; + window.onerror = function() {}; window.location = url; }; instance.web.client_actions.add("reload", "instance.web.Reload"); @@ -698,9 +701,12 @@ instance.web.Menu = instance.web.Widget.extend({ return this.do_reload(); }, do_reload: function() { - return this.rpc("/web/menu/load", {}).then(this.on_loaded); + var self = this; + return this.rpc("/web/menu/load", {}).then(function(r) { + self.menu_loaded(r); + }); }, - on_loaded: function(data) { + menu_loaded: function(data) { var self = this; this.data = data; this.renderElement(); @@ -717,6 +723,7 @@ instance.web.Menu = instance.web.Widget.extend({ if (self.current_menu) { self.open_menu(self.current_menu); } + this.trigger('menu_loaded', data); this.has_been_loaded.resolve(); }, limit_entries: function() { @@ -878,9 +885,8 @@ instance.web.UserMenu = instance.web.Widget.extend({ }; this.update_promise = this.update_promise.pipe(fct, fct); }, - on_action: function() { - }, on_menu_logout: function() { + this.trigger('user_logout'); }, on_menu_settings: function() { var self = this; @@ -897,8 +903,7 @@ instance.web.UserMenu = instance.web.Widget.extend({ var $help = $(QWeb.render("UserMenu.about", {version_info: res})); $help.find('a.oe_activate_debug_mode').click(function (e) { e.preventDefault(); - window.location = $.param.querystring( - window.location.href, 'debug'); + window.location = $.param.querystring( window.location.href, 'debug'); }); instance.web.dialog($help, {autoOpen: true, modal: true, width: 507, height: 290, resizable: false, title: _t("About")}); @@ -1019,15 +1024,13 @@ instance.web.WebClient = instance.web.Client.extend({ var state = $.bbq.getState(true); var action = { - 'type': 'ir.actions.client', - 'tag': 'login', - 'params': state + type: 'ir.actions.client', + tag: 'login', + _push_me: false, }; this.action_manager.do_action(action); this.action_manager.inner_widget.on('login_successful', this, function() { - this.do_push_state(state); - this._current_state = null; // ensure the state will be loaded this.show_application(); // will load the state we just pushed }); }, @@ -1039,8 +1042,7 @@ instance.web.WebClient = instance.web.Client.extend({ self.menu.on('menu_click', this, this.on_menu_action); self.user_menu = new instance.web.UserMenu(self); self.user_menu.replace(this.$el.find('.oe_user_menu_placeholder')); - self.user_menu.on_menu_logout.add(this.proxy('on_logout')); - self.user_menu.on_action.add(this.proxy('on_menu_action')); + self.user_menu.on('user_logout', self, self.on_logout); self.user_menu.do_update(); self.bind_hashchange(); self.set_title(); @@ -1103,6 +1105,7 @@ instance.web.WebClient = instance.web.Client.extend({ }); }); } else { + state._push_me = false; // no need to push state back... this.action_manager.do_load_state(state, !!this._current_state); } } @@ -1121,9 +1124,11 @@ instance.web.WebClient = instance.web.Client.extend({ .pipe(function (result) { var action = result; if (options.needaction) { - action.context.search_default_needaction_pending = true; + action.context.search_default_message_unread = true; } - return $.when(self.action_manager.do_action(action, null, true)).fail(function() { + return $.when(self.action_manager.do_action(action, { + clear_breadcrumbs: true, + })).fail(function() { self.menu.open_menu(options.previous_menu_id); }); }); diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index b5fbacc7927..7f4f8c0d6ca 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -291,6 +291,17 @@ var Events = instance.web.Class.extend({ return this; }, + callbackList: function() { + var lst = []; + _.each(this._callbacks || {}, function(el, eventName) { + var node = el; + while ((node = node.next) && node.next) { + lst.push([eventName, node.callback, node.context]); + } + }); + return lst; + }, + trigger : function(events) { var event, node, calls, tail, args, all, rest; if (!(calls = this._callbacks)) @@ -369,9 +380,9 @@ instance.web.EventDispatcherMixin = _.extend({}, instance.web.ParentedMixin, { event.source.__edispatcherEvents.off(event.name, event.func, self); }); this.__edispatcherRegisteredEvents = []; - if(!this.__edispatcherEvents) { - debugger; - } + _.each(this.__edispatcherEvents.callbackList(), function(cal) { + this.off(cal[0], cal[2], cal[1]); + }, this); this.__edispatcherEvents.off(); instance.web.ParentedMixin.destroy.call(this); } @@ -1440,6 +1451,10 @@ instance.web.JsonRPC = instance.web.CallbackEnabled.extend({ }, }); +instance.web.py_eval = function(expr, context) { + return py.eval(expr, _.extend({}, context || {}, {"true": true, "false": false, "null": null})); +}; + } // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index ce85e0ac43f..77583899bf1 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -280,7 +280,8 @@ instance.web.Model = instance.web.Class.extend({ kwargs = args; args = []; } - return instance.session.rpc('/web/dataset/call_kw', { + var debug = instance.session.debug ? '/'+this.name+':'+method : ''; + return instance.session.rpc('/web/dataset/call_kw' + debug, { model: this.name, method: method, args: args, @@ -349,89 +350,6 @@ instance.web.Model = instance.web.Class.extend({ }, }); -instance.web.DataGroup = instance.web.CallbackEnabled.extend({ - /** - * Management interface between views and grouped collections of OpenERP - * records. - * - * The root DataGroup is instantiated with the relevant information - * (a session, a model, a domain, a context and a group_by sequence), the - * domain and context may be empty. It is then interacted with via - * :js:func:`~instance.web.DataGroup.list`, which is used to read the - * content of the current grouping level. - * - * @constructs instance.web.DataGroup - * @extends instance.web.CallbackEnabled - * - * @param {instance.web.CallbackEnabled} parent widget - * @param {String} model name of the model managed by this DataGroup - * @param {Array} domain search domain for this DataGroup - * @param {Object} context context of the DataGroup's searches - * @param {Array} group_by sequence of fields by which to group - * @param {Number} [level=0] nesting level of the group - */ - init: function(parent, model, domain, context, group_by, level) { - this._super(parent, null); - this.model = new instance.web.Model(model, context, domain); - this.group_by = group_by; - this.context = context; - this.domain = domain; - - this.level = level || 0; - }, - list: function (fields, ifGroups, ifRecords) { - var self = this; - var query = this.model.query(fields).order_by(this.sort).group_by(this.group_by); - $.when(query).then(function (querygroups) { - // leaf node - if (!querygroups) { - var ds = new instance.web.DataSetSearch(self, self.model.name, self.model.context(), self.model.domain()); - ds._sort = self.sort; - ifRecords(ds); - return; - } - // internal node - var child_datagroups = _(querygroups).map(function (group) { - var child_context = _.extend( - {}, self.model.context(), group.model.context()); - var child_dg = new instance.web.DataGroup( - self, self.model.name, group.model.domain(), - child_context, group.model._context.group_by, - self.level + 1); - child_dg.sort = self.sort; - // copy querygroup properties - child_dg.__context = child_context; - child_dg.__domain = group.model.domain(); - child_dg.folded = group.get('folded'); - child_dg.grouped_on = group.get('grouped_on'); - child_dg.length = group.get('length'); - child_dg.value = group.get('value'); - child_dg.openable = group.get('has_children'); - child_dg.aggregates = group.get('aggregates'); - return child_dg; - }); - ifGroups(child_datagroups); - }); - } -}); - -instance.web.StaticDataGroup = instance.web.DataGroup.extend({ - /** - * A specialization of data groups, relying on a single static - * dataset as its records provider. - * - * @constructs instance.web.StaticDataGroup - * @extends instance.web.DataGroup - * @param {openep.web.DataSetStatic} dataset a static dataset backing the groups - */ - init: function (dataset) { - this.dataset = dataset; - }, - list: function (fields, ifGroups, ifRecords) { - ifRecords(this.dataset); - } -}); - instance.web.DataSet = instance.web.CallbackEnabled.extend({ /** * Collection of OpenERP records, used to share records and the current selection between views. @@ -567,7 +485,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ */ write: function (id, data, options) { options = options || {}; - return this._model.call('write', [[id], data], {context: this._model.context(options.context)}); + return this._model.call('write', [[id], data], {context: this._model.context(options.context)}).then(this.trigger('dataset_changed', id, data, options)); }, /** * Deletes an existing record from the database @@ -575,8 +493,7 @@ instance.web.DataSet = instance.web.CallbackEnabled.extend({ * @param {Number|String} ids identifier of the record to delete */ unlink: function(ids) { - this.trigger('unlink', ids); - return this._model.call('unlink', [ids], {context: this._model.context()}); + return this._model.call('unlink', [ids], {context: this._model.context()}).then(this.trigger('dataset_changed', ids)); }, /** * Calls an arbitrary RPC method @@ -774,10 +691,11 @@ instance.web.DataSetSearch = instance.web.DataSet.extend({ if (self._length) { self._length -= 1; } - if (this.index !== null) { + if (self.index !== null) { self.index = self.index <= self.ids.length - 1 ? self.index : (self.ids.length > 0 ? self.ids.length -1 : 0); } + self.trigger("dataset_changed", ids, callback, error_callback); }); }, size: function () { @@ -834,7 +752,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ } $.extend(cached.values, record.values); if (dirty) - this.on_change(); + this.trigger("dataset_changed", id, data, options); return $.Deferred().resolve(true).promise(); }, unlink: function(ids, callback, error_callback) { @@ -848,7 +766,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.to_write = _.reject(this.to_write, function(x) { return _.include(ids, x.id);}); this.cache = _.reject(this.cache, function(x) { return _.include(ids, x.id);}); this.set_ids(_.without.apply(_, [this.ids].concat(ids))); - this.on_change(); + this.trigger("dataset_changed", ids, callback, error_callback); return $.async_when({result: true}).then(callback); }, reset_ids: function(ids) { @@ -859,8 +777,6 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ this.cache = []; this.delete_all = false; }, - on_change: function() { - }, read_ids: function (ids, fields, options) { var self = this; var to_get = []; @@ -947,7 +863,7 @@ instance.web.BufferedDataSet = instance.web.DataSetStatic.extend({ }, alter_ids: function(n_ids) { this._super(n_ids); - this.on_change(); + this.trigger("dataset_changed", n_ids); }, }); instance.web.BufferedDataSet.virtual_id_regex = /^one2many_v_id_.*$/; diff --git a/addons/web/static/src/js/formats.js b/addons/web/static/src/js/formats.js index 3e5e6fecd5e..03b2c5b775d 100644 --- a/addons/web/static/src/js/formats.js +++ b/addons/web/static/src/js/formats.js @@ -135,7 +135,7 @@ instance.web.format_value = function (value, descriptor, value_if_empty) { Math.round((value % 1) * 60)); case 'many2one': // name_get value format - return value[1]; + return value[1] ? value[1].split("\n")[0] : value[1]; case 'one2many': case 'many2many': if (typeof value === 'string') { diff --git a/addons/web/static/src/js/search.js b/addons/web/static/src/js/search.js index a5e1aaeb3ae..c16b65c9831 100644 --- a/addons/web/static/src/js/search.js +++ b/addons/web/static/src/js/search.js @@ -324,8 +324,9 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea context: this.dataset.get_context() }); $.when(load_view) - .pipe(this.on_loaded) - .fail(function () { + .pipe(function(r) { + self.search_view_loaded(r) + }).fail(function () { self.ready.reject.apply(null, arguments); }); } @@ -645,7 +646,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea (new instance.web.search.Advanced(this)); }, - on_loaded: function(data) { + search_view_loaded: function(data) { var self = this; this.fields_view = data.fields_view; if (data.fields_view.type !== 'search' || @@ -654,7 +655,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea "Got non-search view after asking for a search view: type %s, arch root %s", data.fields_view.type, data.fields_view.arch.tag)); } - this.make_widgets( data.fields_view['arch'].children, data.fields_view.fields); @@ -671,9 +671,12 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea 'facet_for_defaults', this.defaults)).then(function () { self.query.reset(_(arguments).compact(), {preventSearch: true}); }); - + return $.when(drawer_started, defaults_fetched) - .then(function () { self.ready.resolve(); }) + .then(function () { + self.trigger("search_view_loaded", data); + self.ready.resolve(); + }); }, /** * Handle event when the user make a selection in the filters management select box. @@ -763,7 +766,8 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea groupbys: groupbys, errors: errors }; - }, /** + }, + /** * Performs the search view collection of widget data. * * If the collection went well (all fields are valid), then triggers @@ -783,7 +787,7 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea this.on_invalid(search.errors); return; } - return this.on_search(search.domains, search.contexts, search.groupbys); + return this.trigger('search_data', search.domains, search.contexts, search.groupbys); }, /** * Triggered after the SearchView has collected all relevant domains and @@ -801,8 +805,6 @@ instance.web.SearchView = instance.web.Widget.extend(/** @lends instance.web.Sea * @param {Array} contexts an array of literal contexts or context refs * @param {Array} groupbys ordered contexts which may or may not have group_by keys */ - on_search: function (domains, contexts, groupbys) { - }, /** * Triggered after a validation error in the SearchView fields. * diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index afb5e258c0b..9c97f95f4c9 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -110,6 +110,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM "not_interactible_on_create": false, "initial_mode": "view", "disable_autofocus": false, + "footer_to_buttons": false, }); this.is_initialized = $.Deferred(); this.mutating_mutex = new $.Mutex(); @@ -118,7 +119,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.__clicked_inside = false; this.__blur_timeout = null; this.rendering_engine = new instance.web.form.FormRenderingEngine(this); - this.qweb = null; // A QWeb instance will be created if the view is a QWeb template self.set({actual_mode: self.options.initial_mode}); this.has_been_loaded.then(function() { self.on("change:actual_mode", self, self.check_actual_mode); @@ -127,6 +127,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM self.init_pager(); }); self.on("load_record", self, self.load_record); + this.on('view_loaded', self, self.load_form); instance.web.bus.on('clear_uncommitted_changes', this, function(e) { if (!this.can_be_discarded()) { e.preventDefault(); @@ -143,13 +144,13 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } this._super(); }, - on_loaded: function(data) { + load_form: function(data) { var self = this; if (!data) { throw new Error("No data provided."); } if (this.arch) { - throw "Form view does not support multiple calls to on_loaded"; + throw "Form view does not support multiple calls to load_form"; } this.fields_order = []; this.fields_view = data; @@ -157,11 +158,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.rendering_engine.set_fields_registry(this.fields_registry); this.rendering_engine.set_tags_registry(this.tags_registry); this.rendering_engine.set_widgets_registry(this.widgets_registry); - if (!this.extract_qweb_template(data)) { - this.rendering_engine.set_fields_view(data); - var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); - this.rendering_engine.render_to($dest); - } + this.rendering_engine.set_fields_view(data); + var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); + this.rendering_engine.render_to($dest); this.$el.on('mousedown.formBlur', function () { self.__clicked_inside = true; @@ -169,6 +168,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.$buttons = $(QWeb.render("FormView.buttons", {'widget':self})); if (this.options.$buttons) { + this.options.$buttons.children().remove(); this.$buttons.appendTo(this.options.$buttons); } else { this.$el.find('.oe_form_buttons').replaceWith(this.$buttons); @@ -177,6 +177,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this.$buttons.on('click', '.oe_form_button_edit', this.on_button_edit); this.$buttons.on('click', '.oe_form_button_save', this.on_button_save); this.$buttons.on('click', '.oe_form_button_cancel', this.on_button_cancel); + if (this.options.footer_to_buttons) { + this.$el.find('footer').appendTo(this.$buttons); + } this.$sidebar = this.options.$sidebar || this.$el.find('.oe_form_sidebar'); if (!this.sidebar && this.options.$sidebar) { @@ -211,60 +214,9 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM e.stopPropagation(); } }); - + this.trigger('form_view_loaded', data); return $.when(); }, - extract_qweb_template: function(fvg) { - for (var i=0, ii=fvg.arch.children.length; i < ii; i++) { - var child = fvg.arch.children[i]; - if (child.tag === "templates") { - this.qweb = new QWeb2.Engine(); - this.qweb.add_template(instance.web.json_node_to_xml(child)); - if (!this.qweb.has_template('form')) { - throw new Error("No QWeb template found for form view"); - } - return true; - } - } - this.qweb = null; - return false; - }, - get_fvg_from_qweb: function(record) { - var view = this.qweb.render('form', this.get_qweb_context(record)); - var fvg = _.clone(this.fields_view); - fvg.arch = instance.web.xml_to_json(instance.web.str_to_xml(view).firstChild); - return fvg; - }, - get_qweb_context: function(record) { - var self = this, - new_record = {}; - _.each(record, function(value_, name) { - var r = _.clone(self.fields_view.fields[name] || {}); - if ((r.type === 'date' || r.type === 'datetime') && value_) { - r.raw_value = instance.web.auto_str_to_date(value_); - } else { - r.raw_value = value_; - } - r.value = instance.web.format_value(value_, r); - new_record[name] = r; - }); - return { - record : new_record, - new_record : !record.id - }; - }, - kill_current_form: function() { - _.each(this.getChildren(), function(el) { - el.destroy(); - }); - this.fields = {}; - this.fields_order = []; - this.default_focus_field = null; - this.default_focus_button = null; - this.translatable_fields = []; - this.$el.find('.oe_form_container').empty(); - }, - widgetFocused: function() { // Clear click flag if used to focus a widget this.__clicked_inside = false; @@ -368,13 +320,6 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM this._actualize_mode(); this.set({ 'title' : record.id ? record.display_name : "New" }); - if (this.qweb) { - this.kill_current_form(); - this.rendering_engine.set_fields_view(this.get_fvg_from_qweb(record)); - var $dest = this.$el.hasClass("oe_form_container") ? this.$el : this.$el.find('.oe_form_container'); - this.rendering_engine.render_to($dest); - } - _(this.fields).each(function (field, f) { field._dirty_flag = false; field._inhibit_on_change_flag = true; @@ -395,6 +340,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }); } self.on_form_changed(); + self.rendering_engine.init_fields(); self.is_initialized.resolve(); self.do_update_pager(record.id == null); if (self.sidebar) { @@ -431,7 +377,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM do_notify_change: function() { this.$el.add(this.$buttons).addClass('oe_form_dirty'); }, - on_pager_action: function(action) { + execute_pager_action: function(action) { if (this.can_be_discarded()) { switch (action) { case 'first': @@ -448,6 +394,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM break; } this.reload(); + this.trigger('pager_action_executed'); } }, init_pager: function() { @@ -464,7 +411,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } this.$pager.on('click','a[data-pager-action]',function() { var action = $(this).data('pager-action'); - self.on_pager_action(action); + self.execute_pager_action(action); }); this.do_update_pager(); }, @@ -737,7 +684,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM } for (var i = 0; i < fields_order.length; i += 1) { var field = this.fields[fields_order[i]]; - if (!field.get('effective_invisible') && !field.get('effective_readonly')) { + if (!field.get('effective_invisible') && !field.get('effective_readonly') && field.$label) { if (field.focus() !== false) { break; } @@ -747,7 +694,8 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }, on_button_save: function() { var self = this; - return this.do_save().then(function(result) { + return this.save().then(function(result) { + self.trigger("save", result); self.to_view_mode(); }); }, @@ -784,7 +732,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM var def = $.Deferred(); $.when(this.has_been_loaded).then(function() { self.dataset.call('copy', [self.datarecord.id, {}, self.dataset.context]).then(function(new_id) { - return self.record_created({ result : new_id }); + return self.record_created(new_id); }).then(function() { return self.to_edit_mode(); }).then(function() { @@ -799,7 +747,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM $.when(this.has_been_loaded).then(function() { if (self.datarecord.id && confirm(_t("Do you really want to delete this record?"))) { self.dataset.unlink([self.datarecord.id]).then(function() { - self.on_pager_action('next'); + self.execute_pager_action('next'); def.resolve(); }); } else { @@ -824,11 +772,11 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM * record or saving an existing one depending on whether the record * already has an id property. * - * @param {Boolean} [prepend_on_create=false] if ``do_save`` creates a new + * @param {Boolean} [prepend_on_create=false] if ``save`` creates a new * record, should that record be inserted at the start of the dataset (by * default, records are added at the end) */ - do_save: function(prepend_on_create) { + save: function(prepend_on_create) { var self = this; return this.mutating_mutex.exec(function() { return self.is_initialized.pipe(function() { try { @@ -843,7 +791,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM if (!first_invalid_field) { first_invalid_field = f; } - } else if (f.name !== 'id' && (!self.datarecord.id || (!f.get("readonly") && f._dirty_flag))) { + } else if (f.name !== 'id' && !f.get("readonly") && (!self.datarecord.id || f._dirty_flag)) { // Special case 'id' field, do not save this field // on 'create' : save all non readonly fields // on 'edit' : save non readonly modified fields @@ -956,7 +904,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM var self = this; return this.reload_mutex.exec(function() { if (self.dataset.index == null) { - self.do_prev_view(); + self.trigger("previous_view"); return $.Deferred().reject().promise(); } if (self.dataset.index == null || self.dataset.index < 0) { @@ -1000,7 +948,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM }, recursive_save: function() { var self = this; - return $.when(this.do_save()).pipe(function(res) { + return $.when(this.save()).pipe(function(res) { if (self.dataset.parent_view) return self.dataset.parent_view.recursive_save(); }); @@ -1031,10 +979,20 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM return true; }, sidebar_context: function () { - return this.do_save().pipe(_.bind(function() {return this.get_fields_values();}, this)); + return this.save().pipe(_.bind(function() {return this.get_fields_values();}, this)); }, open_defaults_dialog: function () { var self = this; + var display = function (field, value) { + if (field instanceof instance.web.form.FieldSelection) { + return _(field.values).find(function (option) { + return option[0] === value; + })[1]; + } else if (field instanceof instance.web.form.FieldMany2One) { + return field.get_displayed(); + } + return value; + } var fields = _.chain(this.fields) .map(function (field, name) { var value = field.get_value(); @@ -1048,29 +1006,28 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM || field.field.type === 'binary') { return false; } - var displayed = value; - if (field instanceof instance.web.form.FieldSelection) { - displayed = _(field.values).find(function (option) { - return option[0] === value; - })[1]; - } else if (field instanceof instance.web.form.FieldMany2One) { - displayed = field.get_displayed(); - } return { name: name, string: field.string, value: value, - displayed: displayed, - // convert undefined to false - change_default: !!field.field.change_default + displayed: display(field, value), } }) .compact() .sortBy(function (field) { return field.string; }) .value(); - var conditions = _.chain(fields) - .filter(function (field) { return field.change_default; }) + var conditions = _.chain(self.fields) + .filter(function (field) { return field.field.change_default; }) + .map(function (field, name) { + var value = field.get_value(); + return { + name: name, + string: field.string, + value: value, + displayed: display(field, value), + } + }) .value(); var d = new instance.web.Dialog(this, { @@ -1096,7 +1053,7 @@ instance.web.FormView = instance.web.View.extend(instance.web.form.FieldManagerM field_to_set, self.fields[field_to_set].get_value(), all_users, - false, + true, condition || false ]).then(function () { d.close(); }); }} @@ -1226,7 +1183,9 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt this.$form.appendTo(this.$target); - var ws = _.map(this.fields_to_init, function($elem) { + this.to_replace = []; + + _.each(this.fields_to_init, function($elem) { var name = $elem.attr("name"); if (!self.fvg.fields[name]) { throw new Error("Field '" + name + "' specified in view could not be found."); @@ -1242,24 +1201,28 @@ instance.web.form.FormRenderingEngine = instance.web.form.FormRenderingEngineInt } self.alter_field(w); self.view.register_field(w, $elem.attr("name")); - return [w, $elem]; - }); - _.each(ws, function(w) { - w[0].replace(w[1]); + self.to_replace.push([w, $elem]); }); _.each(this.tags_to_init, function($elem) { var tag_name = $elem[0].tagName.toLowerCase(); var obj = self.tags_registry.get_object(tag_name); var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); - w.replace($elem); + self.to_replace.push([w, $elem]); }); _.each(this.widgets_to_init, function($elem) { var widget_type = $elem.attr("type"); var obj = self.widgets_registry.get_object(widget_type); var w = new (obj)(self.view, instance.web.xml_to_json($elem[0])); - w.replace($elem); + self.to_replace.push([w, $elem]); }); - // TODO: return a deferred + }, + init_fields: function() { + var defs = []; + _.each(this.to_replace, function(el) { + defs.push(el[0].replace(el[1])); + }); + this.to_replace = []; + return $.when.apply($, defs); }, render_element: function(template /* dictionaries */) { var dicts = [].slice.call(arguments).slice(1); @@ -1660,6 +1623,8 @@ instance.web.form.FormDialog = instance.web.Dialog.extend({ }); instance.web.form.compute_domain = function(expr, fields) { + if (! (expr instanceof Array)) + return !! expr; var stack = []; for (var i = expr.length - 1; i >= 0; i--) { var ex = expr[i]; @@ -2006,12 +1971,9 @@ instance.web.form.FieldInterface = { /** * Called by the form view to indicate the value of the field. * - * set_value() may return an object that can be passed to $.when() that represents the moment when - * the field has finished all operations necessary before the user can effectively use the widget. - * * Multiple calls to set_value() can occur at any time and must be handled correctly by the implementation, - * regardless of any asynchronous operation currently running and the status of any promise that a - * previous call to set_value() could have returned. + * regardless of any asynchronous operation currently running. Calls to set_value() can and will also occur + * before the widget is inserted into the DOM. * * set_value() must be able, at any moment, to handle the syntax returned by the "read" method of the * osv class in the OpenERP server as well as the syntax used by the set_value() (see below). It must @@ -2087,11 +2049,7 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this.field = this.field_manager.get_field_desc(this.name); this.widget = this.node.attrs.widget; this.string = this.node.attrs.string || this.field.string || this.name; - try { - this.options = JSON.parse(this.node.attrs.options || '{}'); - } catch (e) { - throw new Error(_.str.sprintf(_t("Widget options for field '%s' are not valid JSON."), this.name)); - } + this.options = instance.web.py_eval(this.node.attrs.options || '{}'); this.set({'value': false}); this.on("change:value", this, function() { @@ -2125,6 +2083,14 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w this.field_manager.on("change:display_invalid_fields", this, this._check_css_flags); this._check_css_flags(); }, + start: function() { + var tmp = this._super(); + this.on("change:value", this, function() { + if (! this.no_rerender) + this.render_value(); + }); + this.render_value(); + }, /** * Private. Do not use. */ @@ -2137,6 +2103,20 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w get_value: function() { return this.get('value'); }, + /** + Utility method that all implementations should use to change the + value without triggering a re-rendering. + */ + internal_set_value: function(value_) { + var tmp = this.no_render; + this.no_rerender = true; + this.set({'value': value_}); + this.no_rerender = tmp; + }, + /** + This method is called each time the value is modified. + */ + render_value: function() {}, is_valid: function() { return this.is_syntax_valid() && !(this.get('required') && this.is_false()); }, @@ -2181,11 +2161,11 @@ instance.web.form.AbstractField = instance.web.form.FormWidget.extend(instance.w */ instance.web.form.ReinitializeWidgetMixin = { /** - * Default implementation of start(), use it or call explicitly initialize_field(). + * Default implementation of, you should not override it, use initialize_field() instead. */ start: function() { - this._super(); this.initialize_field(); + this._super(); }, initialize_field: function() { this.on("change:effective_readonly", this, this.reinitialize); @@ -2212,18 +2192,10 @@ instance.web.form.ReinitializeWidgetMixin = { * switch. */ instance.web.form.ReinitializeFieldMixin = _.extend({}, instance.web.form.ReinitializeWidgetMixin, { - initialize_field: function() { - instance.web.form.ReinitializeWidgetMixin.initialize_field.call(this); - this.render_value(); - }, reinitialize: function() { instance.web.form.ReinitializeWidgetMixin.reinitialize.call(this); this.render_value(); }, - /** - * Called to render the value. Should also be explicitly called at the end of a set_value(). - */ - render_value: function() {}, }); instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin, { @@ -2237,14 +2209,10 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we var self = this; var $input = this.$el.find('input'); $input.change(function() { - self.set({'value': self.parse_value($input.val())}); + self.internal_set_value(self.parse_value($input.val())); }); this.setupFocus($input); }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - }, render_value: function() { var show_value = this.format_value(this.get('value'), ''); if (!this.get("effective_readonly")) { @@ -2257,7 +2225,7 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we } }, is_syntax_valid: function() { - if (!this.get("effective_readonly")) { + if (!this.get("effective_readonly") && this.$("input").size() > 0) { try { var value_ = this.parse_value(this.$el.find('input').val(), ''); return true; @@ -2348,7 +2316,7 @@ instance.web.form.FieldFloat = instance.web.form.FieldChar.extend({ widget_class: 'oe_form_field_float', init: function (field_manager, node) { this._super(field_manager, node); - this.set({'value': 0}); + this.internal_set_value(0); if (this.node.attrs.digits) { this.digits = this.node.attrs.digits; } else { @@ -2379,7 +2347,10 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ var self = this; this.$input = this.$el.find('input.oe_datepicker_master'); this.$input_picker = this.$el.find('input.oe_datepicker_container'); - this.$input.change(this.on_change); + this.$input.change(function(){ + self.change_datetime(); + }); + this.picker({ onClose: this.on_picker_select, onSelect: this.on_picker_select, @@ -2447,9 +2418,10 @@ instance.web.DateTimeWidget = instance.web.Widget.extend({ format_client: function(v) { return instance.web.format_value(v, {"widget": this.type_of_date}); }, - on_change: function() { + change_datetime: function() { if (this.is_valid_()) { this.set_value_from_ui_(); + this.trigger("datetime_changed"); } } }); @@ -2473,17 +2445,13 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(instanc initialize_content: function() { if (!this.get("effective_readonly")) { this.datewidget = this.build_widget(); - this.datewidget.on_change.add_last(_.bind(function() { - this.set({'value': this.datewidget.get_value()}); + this.datewidget.on('datetime_changed', this, _.bind(function() { + this.internal_set_value(this.datewidget.get_value()); }, this)); this.datewidget.appendTo(this.$el); this.setupFocus(this.datewidget.$input); } }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - }, render_value: function() { if (!this.get("effective_readonly")) { this.datewidget.set_value(this.get('value')); @@ -2492,7 +2460,7 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(instanc } }, is_syntax_valid: function() { - if (!this.get("effective_readonly")) { + if (!this.get("effective_readonly") && this.datewidget) { return this.datewidget.is_valid_(); } return true; @@ -2525,7 +2493,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we this.default_height = this.$textarea.css('height'); if (!this.get("effective_readonly")) { this.$textarea.change(_.bind(function() { - self.set({'value': instance.web.parse_value(self.$textarea.val(), self)}); + self.internal_set_value(instance.web.parse_value(self.$textarea.val(), self)); }, this)); } else { this.$textarea.attr('disabled', 'disabled'); @@ -2537,12 +2505,8 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we }); this.setupFocus(this.$textarea); }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - $(window).resize(); - }, render_value: function() { + $(window).resize(); var show_value = instance.web.format_value(this.get('value'), this, ''); if (show_value === '') { this.$textarea.css('height', parseInt(this.default_height)+"px"); @@ -2551,7 +2515,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we this.$textarea.autosize(); }, is_syntax_valid: function() { - if (!this.get("effective_readonly")) { + if (!this.get("effective_readonly") && this.$textarea) { try { var value_ = instance.web.parse_value(this.$textarea.val(), this, ''); return true; @@ -2602,15 +2566,11 @@ instance.web.form.FieldTextHtml = instance.web.form.AbstractField.extend(instanc this.$cleditor.change(function() { if (! self._updating_editor) { self.$cleditor.updateTextArea(); - self.set({'value': self.$textarea.val()}); + self.internal_set_value(self.$textarea.val()); } }); } }, - set_value: function(value_) { - this._super.apply(this, arguments); - this.render_value(); - }, render_value: function() { if (! this.get("effective_readonly")) { this.$textarea.val(this.get('value') || ''); @@ -2627,21 +2587,20 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({ template: 'FieldBoolean', start: function() { var self = this; - this._super.apply(this, arguments); this.$checkbox = $("input", this.$el); this.setupFocus(this.$checkbox); this.$el.click(_.bind(function() { - this.set({'value': this.$checkbox.is(':checked')}); + this.internal_set_value(this.$checkbox.is(':checked')); }, this)); var check_readonly = function() { self.$checkbox.prop('disabled', self.get("effective_readonly")); }; this.on("change:effective_readonly", this, check_readonly); check_readonly.call(this); - }, - set_value: function(value_) { this._super.apply(this, arguments); - this.$checkbox[0].checked = value_; + }, + render_value: function() { + this.$checkbox[0].checked = this.get('value'); }, focus: function() { this.$checkbox.focus(); @@ -2657,9 +2616,8 @@ instance.web.form.FieldProgressBar = instance.web.form.AbstractField.extend({ disabled: this.get("effective_readonly") }); }, - set_value: function(value_) { - this._super.apply(this, arguments); - var show_value = Number(value_); + render_value: function() { + var show_value = Number(this.get('value')); if (isNaN(show_value)) { show_value = 0; } @@ -2697,7 +2655,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan var ischanging = false; var $select = this.$el.find('select') .change(_.bind(function() { - this.set({'value': this.values[this.$el.find('select')[0].selectedIndex][0]}); + this.internal_set_value(this.values[this.$el.find('select')[0].selectedIndex][0]); }, this)) .change(function () { ischanging = true; }) .click(function () { ischanging = false; }) @@ -2712,7 +2670,6 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan value_ = value_ === null ? false : value_; value_ = value_ instanceof Array ? value_[0] : value_; this._super(value_); - this.render_value(); }, render_value: function() { if (!this.get("effective_readonly")) { @@ -2728,13 +2685,6 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan this.$el.text(option ? option[1] : this.values[0][1]); } }, - is_syntax_valid: function() { - if (this.get("effective_readonly")) { - return true; - } - var value_ = this.values[this.$el.find('select')[0].selectedIndex]; - return !! value_; - }, focus: function() { this.$el.find('select:first').focus(); } @@ -2877,7 +2827,7 @@ instance.web.form.CompletionFieldMixin = { self.build_domain(), new instance.web.CompoundContext(self.build_context(), context || {}) ); - pop.on_select_elements.add(function(element_ids) { + pop.on("elements_selected", self, function(element_ids) { self.add_id(element_ids[0]); self.focus(); }); @@ -2932,26 +2882,27 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc this.display_value = {}; this.last_search = []; this.floating = false; - this.inhibit_on_change = false; this.current_display = null; + this.is_started = false; }, - start: function() { - this._super(); - instance.web.form.ReinitializeFieldMixin.start.call(this); - this.on("change:value", this, function() { - this.floating = false; + reinit_value: function(val) { + this.internal_set_value(val); + this.floating = false; + if (this.is_started) this.render_value(); - }); + }, + initialize_field: function() { + this.is_started = true; instance.web.bus.on('click', this, function() { if (!this.get("effective_readonly") && this.$input && this.$input.autocomplete('widget').is(':visible')) { this.$input.autocomplete("close"); } }); + instance.web.form.ReinitializeFieldMixin.initialize_field.call(this); }, initialize_content: function() { if (!this.get("effective_readonly")) this.render_editable(); - this.render_value(); }, init_error_displayer: function() { // nothing @@ -3002,7 +2953,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc if (self.current_display !== self.$input.val()) { self.current_display = self.$input.val(); if (self.$input.val() === "") { - self.set({value: false}); + self.internal_set_value(false); self.floating = false; } else { self.floating = true; @@ -3034,15 +2985,14 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc if (self.last_search[0][0] != self.get("value")) { self.display_value = {}; self.display_value["" + self.last_search[0][0]] = self.last_search[0][1]; - self.set({value: self.last_search[0][0]}); + self.reinit_value(self.last_search[0][0]); } else { used = true; self.render_value(); } } else { used = true; - self.set({value: false}); - self.render_value(); + self.reinit_value(false); } self.floating = false; } @@ -3097,7 +3047,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc if (item.id) { self.display_value = {}; self.display_value["" + item.id] = item.name; - self.set({value: item.id}); + self.reinit_value(item.id); } else if (item.action) { item.action(); // Cancel widget blurring, to avoid form blur event @@ -3188,16 +3138,14 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc value_ = value_[0]; } value_ = value_ || false; - this.inhibit_on_change = true; - this._super(value_); - this.inhibit_on_change = false; + this.reinit_value(value_); }, get_displayed: function() { return this.display_value["" + this.get("value")]; }, add_id: function(id) { this.display_value = {}; - this.set({value: id}); + this.reinit_value(id); }, is_false: function() { return ! this.get("value"); @@ -3270,9 +3218,18 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ lazy_build_o2m_kanban_view(); this.is_loaded = $.Deferred(); this.initial_is_loaded = this.is_loaded; - this.is_setted = $.Deferred(); this.form_last_update = $.Deferred(); this.init_form_last_update = this.form_last_update; + this.is_started = false; + this.dataset = new instance.web.form.One2ManyDataSet(this, this.field.relation); + this.dataset.o2m = this; + this.dataset.parent_view = this.view; + this.dataset.child_name = this.name; + var self = this; + this.dataset.on('dataset_changed', this, function() { + self.trigger_on_change(); + }); + this.set_value([]); }, start: function() { this._super.apply(this, arguments); @@ -3280,17 +3237,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ var self = this; - this.dataset = new instance.web.form.One2ManyDataSet(this, this.field.relation); - this.dataset.o2m = this; - this.dataset.parent_view = this.view; - this.dataset.child_name = this.name; - this.dataset.on_change.add_last(function() { - self.trigger_on_change(); - }); - - this.is_setted.then(function() { - self.load_views(); - }); + self.load_views(); this.is_loaded.then(function() { self.on("change:effective_readonly", self, function() { self.is_loaded = self.is_loaded.pipe(function() { @@ -3301,6 +3248,8 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ }); }); }); + this.is_started = true; + this.reload_current_view(); }, trigger_on_change: function() { var tmp = this.doing_on_change; @@ -3372,7 +3321,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ var def = $.Deferred().then(function() { self.initial_is_loaded.resolve(); }); - this.viewmanager.on_controller_inited.add_last(function(view_type, controller) { + this.viewmanager.on("controller_inited", self, function(view_type, controller) { controller.o2m = self; if (view_type == "list") { if (self.get("effective_readonly")) { @@ -3387,9 +3336,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ controller.on("load_record", self, function(){ once.resolve(); }); - controller.on_pager_action.add_first(function() { - self.save_any_view(); - }); + controller.on('pager_action_executed',self,self.save_any_view); } else if (view_type == "graph") { self.reload_current_view() } @@ -3404,10 +3351,8 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ } }); }); - this.is_setted.then(function() { - $.async_when().then(function () { - self.viewmanager.appendTo(self.$el); - }); + $.async_when().then(function () { + self.viewmanager.appendTo(self.$el); }); return def; }, @@ -3487,9 +3432,12 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ if (this.dataset.index === null && this.dataset.ids.length > 0) { this.dataset.index = 0; } - self.is_setted.resolve(); this.trigger_on_change(); - return self.reload_current_view(); + if (this.is_started) { + return self.reload_current_view(); + } else { + return $.when(); + } }, get_value: function() { var self = this; @@ -3524,7 +3472,7 @@ instance.web.form.FieldOne2Many = instance.web.form.AbstractField.extend({ if (!view.is_initialized.isResolved()) { return false; } - var res = $.when(view.do_save()); + var res = $.when(view.save()); if (!res.isResolved() && !res.isRejected()) { console.warn("Asynchronous get_value() is not supported in form view."); } @@ -3581,7 +3529,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ create_function: function(data) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.on_change(); + self.o2m.dataset.trigger("dataset_changed", r); }); }, write_function: function(id, data, options) { @@ -3598,7 +3546,7 @@ instance.web.form.One2ManyViewManager = instance.web.ViewManager.extend({ form_view_options: {'not_interactible_on_create':true}, readonly: self.o2m.get("effective_readonly") }); - pop.on_select_elements.add_last(function() { + pop.on("elements_selected", self, function() { self.o2m.reload_current_view(); }); }, @@ -3671,7 +3619,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ create_function: function(data, callback, error_callback) { return self.o2m.dataset.create(data).then(function(r) { self.o2m.dataset.set_ids(self.o2m.dataset.ids.concat([r])); - self.o2m.dataset.on_change(); + self.o2m.dataset.trigger("dataset_changed", r); }).then(callback, error_callback); }, read_function: function() { @@ -3684,7 +3632,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ self.o2m.build_domain(), self.o2m.build_context() ); - pop.on_select_elements.add_last(function() { + pop.on("elements_selected", self, function() { self.o2m.reload_current_view(); }); } @@ -3720,7 +3668,7 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({ var self = this; this.ensure_saved().pipe(function () { if (parent_form) - return parent_form.do_save(); + return parent_form.save(); else return $.when(); }).then(function () { @@ -3855,11 +3803,11 @@ instance.web.form.One2ManyList = instance.web.ListView.List.extend({ instance.web.form.One2ManyFormView = instance.web.FormView.extend({ form_template: 'One2Many.formview', - on_loaded: function(data) { + load_form: function(data) { this._super(data); var self = this; this.$buttons.find('button.oe_form_button_create').click(function() { - self.do_save().then(self.on_button_new); + self.save().then(self.on_button_new); }); }, do_notify_change: function() { @@ -3887,11 +3835,6 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in this._display_orderer = new instance.web.DropMisordered(); this._drop_shown = false; }, - start: function() { - this._super(); - instance.web.form.ReinitializeFieldMixin.start.call(this); - this.on("change:value", this, this.render_value); - }, initialize_content: function() { if (this.get("effective_readonly")) return; @@ -4013,36 +3956,33 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ disable_utility_classes: true, init: function(field_manager, node) { this._super(field_manager, node); - this.set({"value": []}); this.is_loaded = $.Deferred(); this.initial_is_loaded = this.is_loaded; - this.is_setted = $.Deferred(); + this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); + this.dataset.m2m = this; + var self = this; + this.dataset.on('unlink', self, function(ids) { + self.dataset_changed(); + }); + this.set_value([]); }, start: function() { - this._super.apply(this, arguments); this.$el.addClass('oe_form_field oe_form_field_many2many'); var self = this; - this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); - this.dataset.m2m = this; - this.dataset.on('unlink', self, function(ids) { - self.dataset_changed(); - }); - - this.is_setted.then(function() { - self.load_view(); - }); + self.load_view(); this.is_loaded.then(function() { self.on("change:effective_readonly", self, function() { self.is_loaded = self.is_loaded.pipe(function() { self.list_view.destroy(); return $.when(self.load_view()).then(function() { - self.reload_content(); + self.render_value(); }); }); }); }); + this._super.apply(this, arguments); }, set_value: function(value_) { value_ = value_ || []; @@ -4050,17 +3990,12 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ value_ = value_[0][2]; } this._super(value_); - this.dataset.set_ids(value_); - var self = this; - self.reload_content(); - this.is_setted.resolve(); }, get_value: function() { return [commands.replace_with(this.get('value'))]; }, - is_false: function () { - return _(this.dataset.ids).isEmpty(); + return _(this.get("value")).isEmpty(); }, load_view: function() { var self = this; @@ -4078,7 +4013,7 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ } this.list_view.m2m_field = this; var loaded = $.Deferred(); - this.list_view.on_loaded.add_last(function() { + this.list_view.on("list_view_loaded", self, function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4087,14 +4022,15 @@ instance.web.form.FieldMany2Many = instance.web.form.AbstractField.extend({ }); return loaded; }, - reload_content: function() { + render_value: function() { var self = this; + this.dataset.set_ids(this.get("value")); this.is_loaded = this.is_loaded.pipe(function() { return self.list_view.reload_content(); }); }, dataset_changed: function() { - this.set({'value': this.dataset.ids}); + this.internal_set_value(this.dataset.ids); }, }); @@ -4121,7 +4057,7 @@ instance.web.form.Many2ManyListView = instance.web.ListView.extend(/** @lends in this.m2m_field.build_context() ); var self = this; - pop.on_select_elements.add(function(element_ids) { + pop.on("elements_selected", self, function(element_ids) { _.each(element_ids, function(one_id) { if(! _.detect(self.dataset.ids, function(x) {return x == one_id;})) { self.dataset.set_ids([].concat(self.dataset.ids, [one_id])); @@ -4150,28 +4086,26 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( m2m_kanban_lazy_init(); this.is_loaded = $.Deferred(); this.initial_is_loaded = this.is_loaded; - this.is_setted = $.Deferred(); + + var self = this; + this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); + this.dataset.m2m = this; + this.dataset.on('unlink', self, function(ids) { + self.dataset_changed(); + }); }, start: function() { this._super.apply(this, arguments); var self = this; - this.dataset = new instance.web.form.Many2ManyDataSet(this, this.field.relation); - this.dataset.m2m = this; - this.dataset.on('unlink', self, function(ids) { - self.dataset_changed(); - }); - - this.is_setted.then(function() { - self.load_view(); - }); + self.load_view(); this.is_loaded.then(function() { self.on("change:effective_readonly", self, function() { self.is_loaded = self.is_loaded.pipe(function() { self.kanban_view.destroy(); return $.when(self.load_view()).then(function() { - self.reload_content(); + self.render_value(); }); }); }); @@ -4183,10 +4117,6 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( value_ = value_[0][2]; } this._super(value_); - this.dataset.set_ids(value_); - var self = this; - self.reload_content(); - this.is_setted.resolve(); }, load_view: function() { var self = this; @@ -4203,7 +4133,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( } this.kanban_view.m2m = this; var loaded = $.Deferred(); - this.kanban_view.on_loaded.add_last(function() { + this.kanban_view.on("kanban_view_loaded",self,function() { self.initial_is_loaded.resolve(); loaded.resolve(); }); @@ -4213,8 +4143,9 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( }); return loaded; }, - reload_content: function() { + render_value: function() { var self = this; + this.dataset.set_ids(this.get("value")); this.is_loaded = this.is_loaded.pipe(function() { return self.kanban_view.do_search(self.build_domain(), self.dataset.get_context(), []); }); @@ -4236,12 +4167,12 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( new instance.web.CompoundDomain(this.build_domain(), ["!", ["id", "in", this.dataset.ids]]), this.build_context() ); - pop.on_select_elements.add(function(element_ids) { + pop.on("elements_selected", self, function(element_ids) { _.each(element_ids, function(one_id) { if(! _.detect(self.dataset.ids, function(x) {return x == one_id;})) { self.dataset.set_ids([].concat(self.dataset.ids, [one_id])); self.dataset_changed(); - self.reload_content(); + self.render_value(); } }); }); @@ -4252,7 +4183,7 @@ instance.web.form.FieldMany2ManyKanban = instance.web.form.AbstractField.extend( title: _t("Open: ") + self.string, write_function: function(id, data, options) { return self.dataset.write(id, data, {}).then(function() { - self.reload_content(); + self.render_value(); }); }, alternative_form_view: self.field.views ? self.field.views["form"] : undefined, @@ -4402,9 +4333,8 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ self.check_exit(true); }, title: this.options.title || "", - buttons: [{text:"tmp"}], }, this.$el).open(); - this.$buttonpane = dialog.$el.dialog("widget").find(".ui-dialog-buttonpane").html(""); + this.$buttonpane = dialog.$buttons; this.start(); }, setup_form_view: function() { @@ -4427,7 +4357,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ this.view_form.set_embedded_view(this.options.alternative_form_view); } this.view_form.appendTo(this.$el.find(".oe_popup_form")); - this.view_form.on_loaded.add_last(function() { + this.view_form.on("form_view_loaded", self, function() { var multi_select = self.row_id === null && ! self.options.disable_multiple_selection; self.$buttonpane.html(QWeb.render("AbstractFormPopup.buttons", { multi_select: multi_select, @@ -4435,7 +4365,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ })); var $snbutton = self.$buttonpane.find(".oe_abstractformpopup-form-save-new"); $snbutton.click(function() { - $.when(self.view_form.do_save()).then(function() { + $.when(self.view_form.save()).then(function() { self.view_form.reload_mutex.exec(function() { self.view_form.on_button_new(); }); @@ -4443,7 +4373,7 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ }); var $sbutton = self.$buttonpane.find(".oe_abstractformpopup-form-save"); $sbutton.click(function() { - $.when(self.view_form.do_save()).then(function() { + $.when(self.view_form.save()).then(function() { self.view_form.reload_mutex.exec(function() { self.check_exit(); }); @@ -4456,11 +4386,12 @@ instance.web.form.AbstractFormPopup = instance.web.Widget.extend({ self.view_form.do_show(); }); }, - on_select_elements: function(element_ids) { + select_elements: function(element_ids) { + this.trigger("elements_selected", element_ids); }, check_exit: function(no_destroy) { if (this.created_elements.length > 0) { - this.on_select_elements(this.created_elements); + this.select_elements(this.created_elements); this.created_elements = []; } this.destroy(); @@ -4537,7 +4468,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend } this.searchview = new instance.web.SearchView(this, this.dataset, false, search_defaults); - this.searchview.on_search.add(function(domains, contexts, groupbys) { + this.searchview.on('search_data', self, function(domains, contexts, groupbys) { if (self.initial_ids) { self.do_search(domains.concat([[["id", "in", self.initial_ids]], self.domain]), contexts, groupbys); @@ -4546,7 +4477,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend self.do_search(domains.concat([self.domain]), contexts.concat(self.context), groupbys); } }); - this.searchview.on_loaded.add_last(function () { + this.searchview.on("search_view_loaded", self, function() { self.view_list = new instance.web.form.SelectCreateListView(self, self.dataset, false, _.extend({'deletable': false, @@ -4563,7 +4494,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend }).pipe(function() { self.searchview.do_search(); }); - self.view_list.on_loaded.add_last(function() { + self.view_list.on("list_view_loaded", self, function() { self.$buttonpane.html(QWeb.render("SelectCreatePopup.search.buttons", {widget:self})); var $cbutton = self.$buttonpane.find(".oe_selectcreatepopup-search-close"); $cbutton.click(function() { @@ -4571,7 +4502,7 @@ instance.web.form.SelectCreatePopup = instance.web.form.AbstractFormPopup.extend }); var $sbutton = self.$buttonpane.find(".oe_selectcreatepopup-search-select"); $sbutton.click(function() { - self.on_select_elements(self.selected_ids); + self.select_elements(self.selected_ids); self.destroy(); }); }); @@ -4613,7 +4544,7 @@ instance.web.form.SelectCreateListView = instance.web.ListView.extend({ this.popup.new_object(); }, select_record: function(index) { - this.popup.on_select_elements([this.dataset.ids[index]]); + this.popup.select_elements([this.dataset.ids[index]]); this.popup.destroy(); }, do_select: function(ids, records) { @@ -4641,6 +4572,7 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan destroy_content: function() { if (this.fm) { this.fm.destroy(); + this.fm = undefined; } }, initialize_content: function() { @@ -4662,9 +4594,7 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan modifiers: JSON.stringify({readonly: this.get('effective_readonly')}), }}); this.selection.on("change:value", this, this.on_selection_changed); - this.selection.setElement(this.$(".oe_form_view_reference_selection")); - this.selection.renderElement(); - this.selection.start(); + this.selection.appendTo(this.$(".oe_form_view_reference_selection")); this.selection .on('focused', null, function () {self.trigger('focused')}) .on('blurred', null, function () {self.trigger('blurred')}); @@ -4674,9 +4604,7 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan modifiers: JSON.stringify({readonly: this.get('effective_readonly')}), }}); this.m2o.on("change:value", this, this.data_changed); - this.m2o.setElement(this.$(".oe_form_view_reference_m2o")); - this.m2o.renderElement(); - this.m2o.start(); + this.m2o.appendTo(this.$(".oe_form_view_reference_m2o")); this.m2o .on('focused', null, function () {self.trigger('focused')}) .on('blurred', null, function () {self.trigger('blurred')}); @@ -4684,10 +4612,6 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan is_false: function() { return typeof(this.get_value()) !== 'string'; }, - set_value: function(value_) { - this._super(value_); - this.render_value(); - }, render_value: function() { this.reference_ready = false; var vals = [], sel_val, m2o_val; @@ -4707,9 +4631,9 @@ instance.web.form.FieldReference = instance.web.form.AbstractField.extend(instan var model = this.selection.get_value(), id = this.m2o.get_value(); if (typeof(model) === 'string' && typeof(id) === 'number') { - this.set({'value': model + ',' + id}); + this.internal_set_value(model + ',' + id); } else { - this.set({'value': false}); + this.internal_set_value(false); } }, }); @@ -4808,7 +4732,7 @@ instance.web.form.FieldBinary = instance.web.form.AbstractField.extend(instance. on_clear: function() { if (this.get('value') !== false) { this.binary_value = false; - this.set({'value': false}); + this.internal_set_value(false); } return false; } @@ -4828,10 +4752,6 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({ }); } }, - set_value: function(value_) { - this._super.apply(this, arguments); - this.render_value(); - }, render_value: function() { if (!this.get("effective_readonly")) { var show_value; @@ -4853,7 +4773,7 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({ }, on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { this.binary_value = true; - this.set({'value': file_base64}); + this.internal_set_value(file_base64); var show_value = name + " (" + this.human_filesize(size) + ")"; this.$el.find('input').eq(0).val(show_value); this.set_filename(name); @@ -4867,10 +4787,6 @@ instance.web.form.FieldBinaryFile = instance.web.form.FieldBinary.extend({ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({ template: 'FieldBinaryImage', - set_value: function(value_) { - this._super.apply(this, arguments); - this.render_value(); - }, render_value: function() { var self = this; var url; @@ -4903,7 +4819,7 @@ instance.web.form.FieldBinaryImage = instance.web.form.FieldBinary.extend({ this._super.apply(this, arguments); }, on_file_uploaded_and_valid: function(size, name, content_type, file_base64) { - this.set({'value': file_base64}); + this.internal_set_value(file_base64); this.binary_value = true; this.render_value(); this.set_filename(name); @@ -4921,38 +4837,34 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ this._super(field_manager, node); this.options.clickable = this.options.clickable || (this.node.attrs || {}).clickable || false; this.options.visible = this.options.visible || (this.node.attrs || {}).statusbar_visible || false; - this.selected_value = null; + this.set({value: false}); }, start: function() { - this._super(); - // backward compatibility - this.loaded = new $.Deferred(); if (this.options.clickable) { this.$el.on('click','li',this.on_click_stage); } - // TODO move the following into css :after if (this.$el.parent().is('header')) { this.$el.after('
'); } + this._super(); }, set_value: function(value_) { - var self = this; - this._super(value_); - // find selected value: - // - many2one: [2, "New"] -> 2 - // - selection: new -> new - if (this.field.type == "many2one") { - this.selected_value = value_[0]; - } else { - this.selected_value = value_; + if (value_ instanceof Array) { + value_ = value_[0]; } - // trick to be sure all values are loaded in the form, therefore - // enabling the evaluation of dynamic domains - self.selection = []; - $.async_when().then(function() { - self.get_selection(); + this._super(value_); + }, + render_value: function() { + var self = this; + self.get_selection().then(function() { + var content = QWeb.render("FieldStatus.content", {widget: self}); + self.$el.html(content); + var colors = JSON.parse((self.node.attrs || {}).statusbar_colors || "{}"); + var color = colors[self.get('value')]; + if (color) { + self.$("oe_active").css("color", color); + } }); - return this.loaded; }, /** Get the selection and render it * selection: [[identifier, value_to_display], ...] @@ -4961,53 +4873,37 @@ instance.web.form.FieldStatus = instance.web.form.AbstractField.extend({ */ get_selection: function() { var self = this; + self.selection = []; if (this.field.type == "many2one") { var domain = []; if(!_.isEmpty(this.field.domain) || !_.isEmpty(this.node.attrs.domain)) { - domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.selected_value]]); + domain = new instance.web.CompoundDomain(['|'], self.build_domain(), [['id', '=', self.get('value')]]); } var ds = new instance.web.DataSetSearch(this, this.field.relation, self.build_context(), domain); - ds.read_slice(['name'], {}).done( function (records) { + return ds.read_slice(['name'], {}).pipe(function (records) { for(var i = 0; i < records.length; i++) { self.selection.push([records[i].id, records[i].name]); } - self.render_elements(); - self.loaded.resolve(); }); } else { - this.loaded.resolve(); // For field type selection filter values according to // statusbar_visible attribute of the field. For example: // statusbar_visible="draft,open". var selection = this.field.selection; - for(var i=0; i< selection.length; i++) { + for(var i=0; i < selection.length; i++) { var key = selection[i][0]; - if(key == this.selected_value || !this.options.visible || this.options.visible.indexOf(key) != -1) { + if(key == this.get('value') || !this.options.visible || this.options.visible.indexOf(key) != -1) { this.selection.push(selection[i]); } } - this.render_elements(); - } - }, - /** Renders the widget. This function also checks for statusbar_colors='{"pending": "blue"}' - * attribute in the widget. This allows to set a given color to a given - * state (given by the key of (key, label)). - */ - render_elements: function () { - var self = this; - var content = instance.web.qweb.render("FieldStatus.content", {widget: this}); - this.$el.html(content); - var colors = JSON.parse((this.node.attrs || {}).statusbar_colors || "{}"); - var color = colors[this.selected_value]; - if (color) { - this.$("oe_active").css("color", color); + return $.when(); } }, on_click_stage: function (ev) { var self = this; var $li = $(ev.currentTarget); var val = parseInt($li.data("id")); - if (val != self.selected_value) { + if (val != self.get('value')) { this.view.recursive_save().then(function() { var change = {}; change[self.name] = val; diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 7457ca5ef67..99293b2bb0c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -64,9 +64,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.set_groups(new (this.options.GroupsType)(this)); if (this.dataset instanceof instance.web.DataSetStatic) { - this.groups.datagroup = new instance.web.StaticDataGroup(this.dataset); + this.groups.datagroup = new StaticDataGroup(this.dataset); } else { - this.groups.datagroup = new instance.web.DataGroup( + this.groups.datagroup = new DataGroup( this, this.model, dataset.get_domain(), dataset.get_context()); @@ -83,6 +83,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi }); this.no_leaf = false; + this.on('view_load', self, self.load_list); }, set_default_options: function (options) { this._super(options); @@ -218,7 +219,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi * @param {Object} data.fields_view.arch current list view descriptor * @param {Boolean} grouped Is the list view grouped */ - on_loaded: function(data, grouped) { + load_list: function(data, grouped) { var self = this; this.fields_view = data; this.name = "" + this.fields_view.arch.attrs.string; @@ -358,6 +359,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi this.sidebar.add_toolbar(this.fields_view.toolbar); this.sidebar.$el.hide(); } + this.trigger('list_view_loaded', data, grouped); }, /** * Configures the ListView pager based on the provided dataset's information @@ -399,14 +401,10 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi */ setup_columns: function (fields, grouped) { var registry = instance.web.list.columns; - var reorder = this.options.reorderable; this.columns.splice(0, this.columns.length); this.columns.push.apply(this.columns, _(this.fields_view.arch.children).map(function (field) { var id = field.attrs.name; - if(field.attrs.widget == 'handle' && !reorder){ - field.attrs.reorderable = reorder || true; - } return registry.for_(id, fields[id], field); })); if (grouped) { @@ -415,8 +413,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi } this.visible_columns = _.filter(this.columns, function (column) { - return column.invisible !== '1' && !column.reorderable; + return column.invisible !== '1'; }); + this.aggregate_columns = _(this.visible_columns).invoke('to_aggregate'); }, /** @@ -471,7 +470,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi reload_view: function (grouped, context, initial) { var self = this; var callback = function (field_view_get) { - self.on_loaded(field_view_get, grouped); + self.load_list(field_view_get, grouped); }; if (this.embedded_view) { return $.Deferred().then(callback).resolve(this.embedded_view); @@ -557,7 +556,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi */ do_search: function (domain, context, group_by) { this.page = 0; - this.groups.datagroup = new instance.web.DataGroup( + this.groups.datagroup = new DataGroup( this, this.model, domain, context, group_by); this.groups.datagroup.sort = this.dataset._sort; @@ -1153,7 +1152,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we passtrough_events: 'action deleted row_link', /** * Grouped display for the ListView. Handles basic DOM events and interacts - * with the :js:class:`~instance.web.DataGroup` bound to it. + * with the :js:class:`~DataGroup` bound to it. * * Provides events similar to those of * :js:class:`~instance.web.ListView.List` @@ -1558,6 +1557,60 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we } }); +var DataGroup = instance.web.CallbackEnabled.extend({ + init: function(parent, model, domain, context, group_by, level) { + this._super(parent, null); + this.model = new instance.web.Model(model, context, domain); + this.group_by = group_by; + this.context = context; + this.domain = domain; + + this.level = level || 0; + }, + list: function (fields, ifGroups, ifRecords) { + var self = this; + var query = this.model.query(fields).order_by(this.sort).group_by(this.group_by); + $.when(query).then(function (querygroups) { + // leaf node + if (!querygroups) { + var ds = new instance.web.DataSetSearch(self, self.model.name, self.model.context(), self.model.domain()); + ds._sort = self.sort; + ifRecords(ds); + return; + } + // internal node + var child_datagroups = _(querygroups).map(function (group) { + var child_context = _.extend( + {}, self.model.context(), group.model.context()); + var child_dg = new DataGroup( + self, self.model.name, group.model.domain(), + child_context, group.model._context.group_by, + self.level + 1); + child_dg.sort = self.sort; + // copy querygroup properties + child_dg.__context = child_context; + child_dg.__domain = group.model.domain(); + child_dg.folded = group.get('folded'); + child_dg.grouped_on = group.get('grouped_on'); + child_dg.length = group.get('length'); + child_dg.value = group.get('value'); + child_dg.openable = group.get('has_children'); + child_dg.aggregates = group.get('aggregates'); + return child_dg; + }); + ifGroups(child_datagroups); + }); + } +}); +var StaticDataGroup = DataGroup.extend({ + init: function (dataset) { + this.dataset = dataset; + }, + list: function (fields, ifGroups, ifRecords) { + ifRecords(this.dataset); + } +}); + /** * @mixin Events */ diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index fe0f525fe3f..4803a856f31 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -100,7 +100,7 @@ openerp.web.list_editable = function (instance) { this._super(); } }, - on_loaded: function (data, grouped) { + load_list: function (data, grouped) { var self = this; // tree/@editable takes priority on everything else if present. var result = this._super(data, grouped); @@ -201,10 +201,7 @@ openerp.web.list_editable = function (instance) { }, function () { return self.editor.edit(item, function (field_name, field) { var cell = cells[field_name]; - if (!cell || field.get('effective_readonly')) { - // Readonly fields can just remain the list's, - // form's usually don't have backgrounds &al - field.set({invisible: true}); + if (!cell) { return; } @@ -400,6 +397,21 @@ openerp.web.list_editable = function (instance) { }, setup_events: function () { var self = this; + _.each(this.editor.form.fields, function(field, field_name) { + var field; + var setting = false; + var set_invisible = function() { + if (!setting && field.get("effective_readonly")) { + setting = true; + field.set({invisible: true}); + setting = false; + } + }; + field.on("change:effective_readonly", self, set_invisible); + field.on("change:invisible", self, set_invisible); + set_invisible(); + }); + this.editor.$el.on('keyup keydown', function (e) { if (!self.editor.is_editing()) { return; } var key = _($.ui.keyCode).chain() @@ -724,7 +736,7 @@ openerp.web.list_editable = function (instance) { save: function () { var self = this; return this.form - .do_save(this.delegate.prepends_on_create()) + .save(this.delegate.prepends_on_create()) .pipe(function (result) { var created = result.created && !self.record.id; if (created) { diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f985e5f6dc8..705bc1b214e 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -113,6 +113,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ var item = this.breadcrumbs[index]; item.show(subindex); this.inner_widget = item.widget; + this.inner_action = item.action; return true; }, clear_breadcrumbs: function() { @@ -131,6 +132,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ if (!dups.length) { if (this.getParent().has_uncommitted_changes()) { this.inner_widget = item.widget; + this.inner_action = item.action; this.breadcrumbs.splice(index, 0, item); return false; } else { @@ -139,7 +141,10 @@ instance.web.ActionManager = instance.web.Widget.extend({ } } var last_widget = this.breadcrumbs.slice(-1)[0]; - this.inner_widget = last_widget && last_widget.widget; + if (last_widget) { + this.inner_widget = last_widget.widget; + this.inner_action = last_widget.action; + } }, get_title: function() { var titles = []; @@ -164,6 +169,10 @@ instance.web.ActionManager = instance.web.Widget.extend({ state = state || {}; if (this.getParent() && this.getParent().do_push_state) { if (this.inner_action) { + if (this.inner_action._push_me === false) { + // this action has been explicitly marked as not pushable + return; + } state['title'] = this.inner_action.name; if(this.inner_action.type == 'ir.actions.act_window') { state['model'] = this.inner_action.res_model; @@ -172,7 +181,13 @@ instance.web.ActionManager = instance.web.Widget.extend({ state['action'] = this.inner_action.id; } else if (this.inner_action.type == 'ir.actions.client') { state['action'] = this.inner_action.tag; - //state = _.extend(this.inner_action.params || {}, state); + var params = {}; + _.each(this.inner_action.params, function(v, k) { + if(_.isString(v) || _.isNumber(v)) { + params[k] = v; + } + }); + state = _.extend(params || {}, state); } } if(!this.dialog) { @@ -224,14 +239,19 @@ instance.web.ActionManager = instance.web.Widget.extend({ } }); }, - do_action: function(action, on_close, clear_breadcrumbs, on_reverse_breadcrumb) { + do_action: function(action, options) { + options = _.defaults(options || {}, { + clear_breadcrumbs: false, + on_reverse_breadcrumb: function() {}, + on_close: function() {}, + }); if (_.isString(action) && instance.web.client_actions.contains(action)) { var action_client = { type: "ir.actions.client", tag: action }; - return this.do_action(action_client, on_close, clear_breadcrumbs, on_reverse_breadcrumb); + return this.do_action(action_client, options); } else if (_.isNumber(action) || _.isString(action)) { var self = this; return self.rpc("/web/action/load", { action_id: action }).pipe(function(result) { - return self.do_action(result, on_close, clear_breadcrumbs, on_reverse_breadcrumb); + return self.do_action(result, options); }); } if (!action.type) { @@ -253,7 +273,7 @@ instance.web.ActionManager = instance.web.Widget.extend({ console.error("Action manager can't handle action of type " + action.type, action); return $.Deferred().reject(); } - return this[type](action, on_close, clear_breadcrumbs, on_reverse_breadcrumb); + return this[type](action, options); }, null_action: function() { this.dialog_stop(); @@ -266,32 +286,36 @@ instance.web.ActionManager = instance.web.Widget.extend({ * @param {Function} executor.widget function used to fetch the widget instance * @param {String} executor.klass CSS class to add on the dialog root, if action.target=new * @param {Function} executor.post_process cleanup called after a widget has been added as inner_widget - * @param on_close - * @param clear_breadcrumbs + * @param {Object} options * @return {*} */ - ir_actions_common: function(executor, on_close, clear_breadcrumbs) { + ir_actions_common: function(executor, options) { if (this.inner_widget && executor.action.target !== 'new') { if (this.getParent().has_uncommitted_changes()) { return $.Deferred().reject(); - } else if (clear_breadcrumbs) { + } else if (options.clear_breadcrumbs) { this.clear_breadcrumbs(); } } var widget = executor.widget(); if (executor.action.target === 'new') { - if (this.dialog === null) { - // These buttons will be overwrited by