summaryrefslogtreecommitdiff
path: root/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py
AgeCommit message (Collapse)Author
2020-08-21[IMP] bus: notify user when assets have changedLucas Perais (lpe)
Use case: When the server is restarted, the python is updated, but some users may have an ongoing session in a browser tab This may lead to code being unsynchronized and ultimately to some odd bugs. Purpose: When we are in such a case, that is, the assets were recomputed after a update of the code and a restart of the server by the request of another user, notify connected users that assets have changed. Then propose them to reload the page. Known caveats: - This is not a developer's feature. Since assets computing is ORM cached, they have limited opportunities to rebuild. Namely, the feature won't trigger each time the JS has changed, rather, it will when JS has changed AND the cache has been reset somehow (e.g. when the server is restarted). - This not a portal/website feature either, but only in backend. Business clients won't be notified that the JS has changed. - While requests debug=assets do trigger a recomputing of the *components* of bundles, they do not save a bundle This means that the requests that sends the notification cannot be debug=assets. Task 2034462 closes odoo/odoo#39875 Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2020-05-14[IMP] *: convert to private methodsMartin Trigaux
render, render_template, load, activity_schedule_with_view, get_website_pages should all be private: It should not be possible to render an aribtrary template only with its name or id Still need to render some qweb views from js so the method render_template is kept public. This explains why the website editor still need read access on ir.ui.view as we want to allow any snippet to be rendered.
2019-11-19[IMP] base: split and deprecate load_langMartin Trigaux
load_lang was a kind of hybrid method trying to active or creating a language if not found. This was error prone. Instead rely on two methods with clear purpose: ResLang._create_lang(lang, lang_name=None) - create a new res.lang entry using the locale of the server return the res.lang record to match the API of _activate_lang ResLang._active_lang(code) - activate the given code lang Most of the time, _active_lang is what is expected tools.trans_load_data and IrTranslation._load_module_terms no longer activate the language if not active. Loading the translations should be explicit on an activated language, it is too error prone to silently activate/create a language if not found. Remove lang_name from trans_load_data as no longer needed.
2019-10-30[IMP] tests: log a warning when HttpCase test in at_installChristophe Monniez
When loading a page on an existing starting database, registry is not fully loaded causing potential error when trying to access model existing in database (views, menitem, ...) since model added in last loaded module does not exist in registry. Thus, executing browser js test may lead to errors when executed during an update on a database with other modules installed. HTTPCase should be executed post_install to ensure that registry is fully loaded to avoid this problem. Since HTTPCase are slower than other test, it is also a good idea to execute them at the end, in order to prioritize fast fail. With this commit, a warning is isued if such a test class is tagged to run at install time. While at it, remove deprecated at_install and post_install helpers and remove the deprecated phantom_js alias. closes odoo/odoo#39462 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2019-09-17[FIX] *: remove old deprecated modules/functionsJulien Castiaux
PEP-594 is deprecating a bunch of modules. As part of the cleanup, we are also dealing with long deprecated modules, functions and aliases. * `assert_` -> `assertTrue` * `assertEquals` -> `assertEqual` * `assertNotEquals` -> `assertNotEqual` * `assertAlmostEquals` -> `assertAlmostEqual` * `assertRaisesRegexp` -> `assertRaisesRegex` * `assertRegexpMatches` -> `assertRegex` * `base64.encodestring` -> `base64.encodebytes` * `base64.decodestring` -> `base64.decodebytes` * `inspect.getargspec` -> `inspect.signature` * `inspect.formatargspec` -> `inspect.signature` * `logging.warn` -> `logging.warning` closes odoo/odoo#36863 Task: 2003936 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-08-20[IMP] models: ORM speedupRaphael Collet
This branch is the combination of several optimizations in the ORM: * store field values once in the cache: the cache reflects more faithfully the database, only fields that explicitly depend on the context have an extra indirection in the cache; * delay recomputations by default: use method `recompute` to explicitly flush out pending recomputations; * delay updates in method `write`: updates are stored in a data structure that can be flushed efficiently to the database with method `flush` (which also flush out recomputations); * make method `modified` take advantage of inverse fields to inverse dependencies; * filter records by evaluating a domain on records in Python; * a computed field with `readonly=False` behaves like a normal field with an onchange method; * computed fields are computed in superuser mode by default. Work done by Toufik Ben Jaa, Raphael Collet, Denis Ledoux and Fabien Pinckaers. closes odoo/odoo#35659 Signed-off-by: Denis Ledoux <beledouxdenis@users.noreply.github.com>
2019-08-07[IMP] *: use res.lang methodsMartin Trigaux
get_installed and _lang_get_id are both ormcached and correctly check the context Retrieving a res.lang from a code is a frequent action that can be achieved with _lang_get (cf previous commit). Using _lang_get ensure the active_test in the context is correct and is not poluted with another context propagation issue. odoo/odoo#35490 discussion is an example of bad context propagation closes odoo/odoo#35504 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-07-17[REM] *: calls to @api.multiAdrian Torres
Multi is the default api for methods, it is not necessary to explicitly decorate methods with it, adds clutter and most people use it because they see that the rest of the code uses it. Done with `find . -type f -name '*.py' | xargs sed -i '/@api.multi/d'`
2019-07-12[FIX] core: avoid writting sources during testsXavier-Do
Future runbot improvement may share sources between build, meaning that sources will be readonly to avoid any interaction. _touch() was supposed to handle ro filesystem but f7130556 introduced a new test that was not working in this case. Instead of trying to touch file and pseudomocking the result if the filesystem is readonly, this commit add a real patch on getmtime. cherry-pick of b295723c999 closes odoo/odoo#34816 Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com>
2019-06-18[MERGE] forward port branch saas-12.4 up to 618ea1ab675Christophe Simonis
2019-06-06[FIX] test_assetsbundle: Properly unpatch ir.attachmentLucas Lefèvre
`_patch_method` and `_revert_method` do not work properly. This commit fixes a test which patches `create` and `unlink` of `ir.attachment`. The methods are not correctly unpatched. One consequence: if a module is installed after this test is executed and the new module overrides `create` and `unlink`, the overritten methods are never called. closes odoo/odoo#33952 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2019-06-12[REM] base, website: remove deprecated code from qweb and bundleRomain Derie
The _get_asset method was deprecated since df4072b0b493 Last use of this deprecated method was removed with d7da1d648c2d6 Also, remains and to_html were deprecated since 9cd982bcc81 test_assetsbundle was still using the deprecated method to test.. Closes #33432 Signed-off-by: Romain Derie (rde) <rde@odoo.com>
2019-02-19[IMP] tests: replace browser_js success and failure stringsChristophe Monniez
When evaluating js tests using the browser_js method, they are considered a success when 'ok' is found in the console log and a failure if 'error' is found instead. This is not very robust and recently failed with this commit : 7410de111fe It adds a filter named 'Error' in a view, when the 'click_all' test clicks on this filter, a message with the name of the filter is written in the console, wrongly leading to a test failure. With this commit, the browser_js method expects a log message in the browser console with the explicit text "test successful". On the other hand, any error in the console log will lead to a test failure but a test can be forced to fail with the explicit error message in the browser console "test failed". As a bonus, the python logger should now also log browser js trace messages. closes odoo/odoo#31158
2018-10-19[IMP] assets: remove css files splitGéry Debongnie
Before this commit, our asset bundles had a special behaviour for bundles of type css: because of an old limitation in IE9, css files had to be split to make sure they had less than 4095 rules per stylesheets. Since we no longer support IE9, this code can be removed, which should slightly simplify the bundle code, and should slightly reduce the number of requests required to properly load odoo. closes odoo/odoo#27933
2018-08-10[REF] *: add support for RTL languagesMartin Trigaux
מזל טוב The direction parameter will now have a real impact on the web interface and completly switch the direction of the interface. Add the dependency rtlcss to switch the direction with a css postprocessor. Two different assets will be generated for ltr or rtl /web/content/<...>/web.assets_backend.0.css and /web/content/<...>/rtl/web.assets_backend.0.css to be able to differentiate it easily Adapt the css and views to be easier to switch direction Render graph as it is, do not move y-axis right side, as per mathematical rule value goes left from origin are considered negative, so keep graph as it is for right to left language add test cases for language direction specific assets bundle if language direction is rtl then we also store css files in assets bundle now we store two assets bundle, one for ltr and one for rtl language direction test two assets bundles generated, also test two assets bundle generated for en_US and ar_SY
2018-06-28[MERGE] forward port branch saas-11.3 up to 3cdcbce93cbChristophe Simonis
2018-06-27[MERGE] forward port branch saas-11.2 up to 12ddec3a767Christophe Simonis
2018-06-21[MERGE] forward port branch 11.0 up to c5ed3729709Christophe Simonis
2018-06-15[FIX] qweb: use cdn for asset filesChristophe Matthieu
Refactoring of qweb to call _post_processing_att for each nodes. This change remove the crappy ovewrite in website module. The website overwrite only the _post_processing_att to add the cdn parameters. The static node (without t- attributes) can stay static (remove overwrite of _is_static_node), the cdn is applied at the compile time for this nodes instead of at the running time like the dynamic node.
2018-04-18[REF] test_assetsbundle: adapt bundle testsqsm-odoo
2018-02-12[REF] tests: `TestCursor` is now a proxy to a real `Cursor`Raphael Collet
This allows rpc requests in `HttpCase` to use the cursor `self.cr`, which is now shared between the Python test and the rpc requests. This simplifies code to prepare a JS test, and code to check the result of a JS tour. Fixes #12237
2017-11-27[MOV] base: move ir_* models into models/Thibault Delavallée
2017-09-27[FIX] test_assetsbundle: handle readonly filesDenis Ledoux
If the Odoo server runs with its sources read-only for itself, this is not possible for the server to touch the files contained in the assets. In such a case, instead of touching the file, we alter the attachment checksum, to simulate a change within the modified date. However, in such a case, we can only test that the bundle is well generated again. We can no longer check the change of version and modified date, since the modified date of the files have not changed, and therefore the checksum (which is based on the files modified date, among others) neither.
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet