summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/services
AgeCommit message (Collapse)Author
2021-01-08[FIX] web: fix the RedirectWarningHandler dialog not closingDamien Abeloos
Impacted versions : - 14.0 and higher Steps to reproduce : ``` 1. generate an odoo.exceptions.RedirectWarning 2. click on the primary button ``` Current behavior : ``` 1. the action (argument of the RedirectWarning) is properly executed 2. the WarningDialog is not closed ``` Expected behavior : ``` 1. the action should still be properly executed 2. the WarningDialog should be closed ``` Tests : Added a test to ensure this behavior will not be overwritten in the future. The test is for the CrashManager service, and evaluates the following sequence : ``` Entry: CrashManager receives a odoo.exceptions.RedirectWarning (code 200) via rpc_error Asserts: - The RedirectWarning modal (WarningDialog) should be opened * Upon clicking on the primary button : - The modal should be closed - The action passed as an argument of the odoo.exceptions.RedirectWarning should be executed ``` Origin : the incorrect behavior was introduced with : https://github.com/odoo/odoo/commit/b3d9647695065ea582e4a6b0603f3ebf9fde6976 Task ID: 2430100 closes odoo/odoo#64290 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-12-15[FIX] web: show warning on create onchangeNicolas Lempereur
When you create a new record, you will have in this order: - default_get - onchange (can trigger a warning) - _pushController => close all dialogs since ea2207afeab8c This is an issue since the possible warning is directly hidden to the user. Without the change, the added test failed with: Warning modal should be opened "executing a window action with onchange warning do not hide it": Found 0 elements to click on, instead of 1 opw-2342273 opw-2374051 closes #61732 closes odoo/odoo#63270 X-original-commit: 0784d9ab562379f31558fa44f9b9540c36a03760 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-11-17[FIX] web: handle mail delivery exceptionHiral Bhavsar
Before this commit: When trying to send the notification for the user form, it shows a traceback. This is happening after https://github.com/odoo/odoo/commit/ab4000fb3cf8fa54ba714ceceec391b78d73755e After this commit: Send the notification without any traceback as handle the MailDeliveryException inside CrashManager Task-2333121 closes odoo/odoo#60938 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-10-19[FIX] web: raise Warning triggers a tracebackJulien Castiaux
Create a Server Action with the following code: `raise Warning("")`, when the SA is executed it opens the crash manager with a traceback instead of the user error modal. The `odooExceptionTitleMap` data structure lists all Odoo exceptions that descend from UserError, this structure is used within the `rpc_error` function to filter pure Python exceptions from custom Odoo ones. opw-2365689 closes odoo/odoo#60248 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-08-24[FIX] web: crash_manager uses BrowserDetectionLucas Perais (lpe)
Before this commit, the crash manager used a copy of the browser detection isBrowserChrome method because it was not possible to to register the proper dependency in stable version This commit makes the crash manager use the module BrowserDetection for that purpose, with the proper registered dependency before hand closes odoo/odoo#56360 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-08-21[FIX] web: crash manager correctly formats error message in FirefoxMohammed Shekha
Have a piece of code that throws an Error In browsers not powered by V8, the stack trace won't be formatted and the Error type won't appear in the crash manager modal report. This happens because Error.prototype.stack is non-standard, although most browsers have an implementation of it. Chrome for example automatically formats the Error. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error https://v8.dev/docs/stack-trace-api\#compatibility After this commit, the Error is formatted in the crash manager report, the same way as Chrome does it. task-2191727 closes odoo/odoo#56318 X-original-commit: dbf670f2e0ec797aeaf998aa28b32afbdd2c3b4c Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Signed-off-by: Christophe Monniez (moc) <moc@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com> Co-authored-by: Hardik Prajapati <hap@odoo.com>
2020-08-18[IMP] web: add a size_changed bus eventJeremy Kersten
This commit will add a bus in the web.config config that allows to trigger events. The first use case is the trigger of the size_changed event that is triggered each time the size of the screen changed of bootstrap breakpoint. task-2276740 PR #53175
2020-06-30[IMP] base : improve messages text in access_error pop-upsSébastien Geelen (sge)
* Improve layout of access error messages from group restriction * Improve layout of access error messages from security records rules * Use the error title in the js crash manager when possible * adapt unit tests closes odoo/odoo#50369 Taskid: 2206787 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-05-29[FIX] web: force refresh on expired session popup button clickDhruv Patel
Currently, when the session expired then it generates the popup that "Your odoo session expired. Please refresh the current page." Now once you click on the "Ok" button only close the popup and user have to manually do refresh the page. with this commit, we have changed the text of the popup to "Your odoo session expired. The current page is about to be refreshed." and when user click on "Ok" button forcefully refresh the page. Task : 2241744 closes odoo/odoo#50710 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-04-10[FIX] web, web_editor: allow editor instantiation from public userqsm-odoo
If for some reason someone wanted to develop a textarea using the editor which is supposed to work as a public user (like we are trying to do on Odoo.com), it was not possible. The code was "designed" to allow it but there was one problem: the lazy loading of the editor assets required a `render_template` call to the server... which cannot be done from a public user. This commit solves the issues by allowing the lazy loading of assets to use a custom route if required. That route is then used by the editor "root". That route performs the render_template as a superuser provided that the view's xmlid is whitelisted. Note: there was another unauthorized call for public user: the colorpicker. This was solved by disabling the colorpicker template rpc for public user, they will still get the default summernote one. Part of https://github.com/odoo/odoo/pull/48981 closes odoo/odoo#48981 closes odoo/odoo#49398 X-original-commit: e84a0bfdc99c21406861b88c02b11c925d92f927 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-04-08[REF] base: Remove deprecated exceptions and osvJulien Castiaux
TL;DR: remember `osv` and `except_orm` ? You can forget about them. * Deprecated `except_orm` dropped. * `UserError` elevated as super type of all user-related errors. * Unused `DeferredException` dropped. * Unused `QWebException` dropped (real one is in `qweb.py`). * `MailDeliveryException` made a python exception. * `name` legacy exception attribute made an alias of the python standard `args[0]` attribute and deprecated. * `value` legacy exception attribute dropped. * `exception_type` RPC error response key dropped. * Deprecated `osv` module dropped. * `--osv-memory-age-limit` cli option made an alias of `--transient-age-limit` and deprecated. The `odoo.exceptions.Warning` have long been a deprecated alias to `UserError`. It is going to be removed in a future version but first we explicitly deprecate it with a warning. The `odoo.exceptions.DeferredException` was a very old internal exception, it has been removed without deprecation notice as it is never raised. The `odoo.exceptions.except_orm` has been a deprecated exception type with deprecation warning for 5 years, it has been removed in favor of UserError which becomes the super class of all user-related errors. The `odoo.base.models.ir_mail_server.MailDeliveryException` was inheriting `except_orm`. As it is not related to a user error but is more of a problem an admin much take care of, the exception has been made a Python error. The `exception_type` JSON key in RPC error responses was holding an hardcoded value derived from the exception type. Its usage has been dropped in favor of the `name` JSON key that holds the precise exception name. Again as it was hardly used in the source code (beside the crash manager) it has been dropped without deprecation warning. Since we are here trying to clean odoo custom exceptions, we are also deprecating the `name` exception attribute in favor of the more standard `args[0]` attribute. The `name` (along with `value`) were two attributes used to raise `except_orm` exceptions before the introduction of `UserError`, `AccessError` and related exceptions. The `name` attribute, at the time, was holding the exception type/title. Nowadays it contains the error message. The `value` attribute, at the time, was holding the error message. Nowadays it is no more used. The `osv` module contains very old deprecated aliases. There is no simple way to log a deprecation warning for osv, osv_memory and osv_abstract but as they have not been in use for ages, they have been removed too. To be consistent, the `--osv-memory-age-limit` cli option has been made a deprecated alias to the `--transient-age-limit`. closes odoo/odoo#45723 Task: 2187728 Related: odoo/enterprise#9162 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-03-24[FIX] web: fix dataManager loading cachesJulien Mougenot
Before this commit, coming back on a view when in 'debug=assets' would erase the previously loaded favorites with an 'undefined' value. This was due to an incorrect cache invalidation mechanism in the DataManager's load_views' method. Now the views and filters caches are properly loaded if any of them has been invalidated. closes odoo/odoo#48085 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-19[IMP] web: use do_action instead of BBQ push_state on RedirectWarningRémy Baranx (bar)
In the RedirectWarning exception handler, it is better to use 'do_action()' instead of using a BBQ push_state() and then a location.reload(), to preserve the context and avoid losing menus and breadcrumbs for example. As the RedirectWarning receives only the action ID and not the full action, a new parameter has been added to be able to provide a context. This context is added in the 'additional_context' parameter of the do_action() TaskID: 2168071
2020-03-13[REF] web: Adapt views/actions to new control panelJulien Mougenot
Some web actions/controllers/viewsl have been adapted to properly instantiate the newly refactored control panel and update it accordingly. We needed to adapt the starting mechanism of actions and controllers to ensure that the control panel instantiation did not delay the loading of any widget. Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-02-05[FIX] website, *: lazy load widget assets of the correct websiteqsm-odoo
*: web Before this commit, when a widget declared assets to lazy load through the assetLibs key, the asset was loaded through a context-less call to the server through the base `rpc` function. This caused problems in website: the website ID was not given to the called route and the loaded assets were then stripped of their specific-website parts. This commit solves the problem by allowing the `loadLibs` and `loadAsset` functions to receive an extra argument: an extra `context` to use for the actual call to the server. The method is now available in the ajax service, so that website can add its custom context automatically, the same way it does it for normal `_rpc` calls. Part of https://github.com/odoo/odoo/pull/44596 closes odoo/odoo#44596 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-02-03[IMP] base_automation, web: give possibility to disable/edit failing ↵Denis Ledoux
automated actions If an automated action raises an exception, in the traceback modal: - For admins, display Disable & Edit automated action buttons to be able to directly know with wihch automated action the error occurred, and to give the possibility to edit or disable it quickly, - For regular users, just add a paragraph to tell with which automated action the error occurred, so they can give this useful information to their administrator This is specially useful for databases which have just been upgraded to a newer version, and for which the server action is failing because its code is no longer supported. closes odoo/odoo#44513 X-original-commit: 8f3940c132bbbc99e47fa3f0cba0e768159d9af2 Signed-off-by: Denis Ledoux (dle) <dle@odoo.com>
2019-12-09[REF] web: rewrite pivot view renderer with OWLPierre Rousseau
Because the webclient and other higher level components such as the actionManager are not yet rewritten in OWL, we cannot make a complete migration of the controller and the model to a more OWL-ish code. We have rewritten the renderer completely in OWL, it uses more extensively a template and manages its own state and its sub-components. We did not rewrite the controller, however we have made it inherit from `web.ControllerAdapter` which is a thin compatibility layer used when a odoo controller uses a OWL renderer. In the tests, the only changes are that all the events triggered by the test and handled by OWL must be triggered on DOM nodes directly and not on JQuery elements. closes odoo/odoo#39491 Related: odoo/enterprise#7135 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: VincentSchippefilt <vsc@odoo.com> Co-authored-by: pro-odoo <pro@odoo.com>
2019-10-18[REF] web,barcodes: simplify mobile device detectionRomeo Fragomeli
In this commit, we introduce "isMobileDevice". Do not confuse with isMobile. isMobile: A frequent use case is to have a different render in 'mobile' mode, meaning when the screen is small. This flag (boolean) is true when the size is XS/VSM/SM. It is also updated dynamically. isMobileDevice: Mobile device detection using userAgent. This flag doesn't depend on the size/resolution of the screen. It targets mobile devices which suggests that there is a virtual keyboard. Task ID: 2090202
2019-09-12[IMP] gamification, *: remove KarmaErrorfja-odoo
* = stock, test_website, web, website_forum, website_slides, base Replace KarmaError with AccessError and remove the related override made on crash_manager and ir_http. task-2069890 closes odoo/odoo#36655 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2019-08-28[FIX] gamification, web: Edge does not support obj spread operatorAlexandre Kühn
As of August 20 2019, Microsoft Edge partially supports ECMA2018. For instance, `Promise.prototype.finally()` can be used, but the spread operator does not work on objects. Task-ID 2056070
2019-08-09[IMP] *: change title and subtitle of warningsfja-odoo
* = portal, test_website, web, website The title will now be "Someting went wrong." and we will no longer display the error type as it is not usefull info to the user. The message of the warning modal was not displayed right if too long. Now it will be displayed properly. Related to https://github.com/odoo/odoo/pull/32132 and https://github.com/odoo/odoo/pull/35209 Part of https://github.com/odoo/odoo/pull/35342 task-2047628
2019-07-30[IMP] web: revert warnings display in back-endfja-odoo
Fix for: https://github.com/odoo/odoo/pull/32132 We had changed the display of the warnings in the back-end to be like the front-end (notification toast). This change needs to be reverted. Now the warnings in the front-end are toast notifications and in the back-end they are Warning modals. Part of: https://github.com/odoo/odoo/pull/35209
2019-07-30[FIX] gamification, web: separate gamification/crash_managerfja-odoo
Fix for: https://github.com/odoo/odoo/pull/32132 A reference to gamification was still made in the crash_manager. Part of: https://github.com/odoo/odoo/pull/35209
2019-07-30[FIX] web, *: make crash_manager use services correctlyfja-odoo
* = website_forum, stock Fix for: https://github.com/odoo/odoo/pull/32132 crash_manager.js was using the services while bypassing ServiceProviderMixin That means all services are duplicated, each having their own state. To fix this issue, CrashManager now extends AbstractService. Also crash_manager is now registered in serviceRegistry instead of being instanciated on the fly. The crash_manager now being a Service raise one issue with the tests: The services are not run for the tests but some tests needs the crash_manager 'unhandledrejection' listener. For that matter the services are reenable in qunit. Also the crash_manager's 'unhandledrejection' listener has to have precedence over the qunit listener as it will handle rejections wich have no reason or are not Errors. Part of: https://github.com/odoo/odoo/pull/35209
2019-06-28[IMP] website_forum: display forum errors with notiffja-odoo
Previously the Forum errors were handled with a popover, now the errors will be consistent with the crash_manager and display a toast notification via the show_warning method. Also the KarmaError were previously not displaying the karma needed to perform the action. Now it will display the amount in the error message. The CrashManager show_warning method will now take an options dictionary as a second argument to override it's default behaviour. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-28[IMP] web, *: display rpc warnings with toastsfja-odoo
* = test_website, partner_autocomplete - All the rpc warnings are now displayed using the notification system of https://github.com/odoo/odoo/commit/b94395b50175925fc7d1bd3655e5facb78a8ba2b - test_website is up to date Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-28[IMP] base, web, *: make KarmaError an except_ormfja-odoo
* = gamification, test_website, stock - KarmaError is now handled as a 400 exception. - test_website has been updated. - NO_POSTMORTEM is now clean it was referencing duplicates as most the exceptions inherit from except_orm. - serialize_exception from http.py has been moved to ir_http to take advantage of the odoo inheritance system. We can then extend ir_http serialize_exception method to add the KarmaError logic if and only if gamification is installed. Places where serialize_exception was previously used are updated. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-28[IMP] web, *: display warning/error in frontendfja-odoo
* = account, iap, point_of_sale Removing the CrashManager templates from base.xml and moving it to a new file (crash_manager.xml) to allow lazy loading the required xml only when a crash occurs (necessary for the frontend as no xml is pre-loaded). All rpc errors/warnings are now displayed using the same modal system as the backend (crash_manager.js). CrashManager will now return the WarningDialog and ErrorDialog in addition to the CrashManager itself. In some cases an instance of CrashManager was created just to display a warning/error dialog. In the backend all rpc errors but sessionExpired will be logged. If the exception is a warning, NotFound (403) or except_orm, it will be a warning log. The rest will be exception log. In the frontend all rpc errors will be logged using console.debug instead of console.warn and console.error. This way we can trigger rpc errors in tests without failing them. If a real error happend during a test it will fall back on the backend logger to fail the test. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-28[REF] web: move rpc_error binding into the crash_managerfja-odoo
Moving the rpc_error binding into the crash manager is mandatory for it to be used in the website. Part of https://github.com/odoo/odoo/pull/32132 task-1894820
2019-06-05[IMP] *: use new helper config.isDebug()Romain Derie
Before this commit, both config and session were aliases to odoo.debug. Now, config.isDebug() should be call, with possibility to pass a parameter to check if we are in a specific debug mode such as 'tests' or 'assets'. task-1934445 Coming with https://github.com/odoo/enterprise/pull/4281 Closes https://github.com/odoo/odoo/pull/33213
2019-06-05[IMP] web, web_tour, website, point_of_sale: adapt code to new debugRomain Derie
As now the debug state is stored in session, the JS framework code and some templates needed some changes. First, the debug state is retrieved from session and not the URL anymore. Second, the debug state does not need to be forwarded as it is now persistent. task-1934445 Comes with https://github.com/odoo/enterprise/pull/4281 Closes #33213
2019-05-20[IMP] base,web: Improve webclient startupVincent Schippefilt
Today, some resources that varies very infrequentely are requested on every page load: the menus, the translations and the qweb templates After this commit, there will be 2 improvements that will make the loading of the webclient faster: 1. cache almost static resources forever when loading the /web/ page, the user session will contain the cache key to be used to fetch these resources. As the content of the resource itself it used to compute the hash, the request can be put in cache by the browser forever (for a year). The up side is that in general less requests are needed to load the web client The down side is that the load time and number of queries of /web page has increased to include what is needed to compute the hash of translations, menus and qweb templates 2. trigger the loading of the menus before the download (and startup) of the JS and CSS assets: The menus contains the definition of the action, wich is the first thing needed to load a page in odoo. Starting the loading of the menu much earlier means that when they are not yet in the browser cache (see point 1), the browser does not need to wait for the entire assets to be downloaded and parsed before starting the 'load_menu' request, but instead start it immediately and hold onto a promise to be used instead of the rpc 'load_menu'. Because the request is done before anything else is loaded, including JQuery, it is made in vanilla JS. Co-authored-by: Julien Mougenot <jum@odoo.com>
2019-05-13[IMP] base: Contextualize the multi companyYannick Tivisse
Purpose ======= Allow the user to select the allowed companies for which he wants to see records on top of selecting his current company. It is confusing for users to see the records from the company he is connected to and the records of the children companies. Instead of using the hierarchy of companies to access records across companies, the user can now select (from his set of allowed companies) the companies for which he wants to access records. /!\ This means that the user will interact with records from company A when in company B. Example: a SO has been created and confirmed in A. When in B, I create the invoice from it. Specifications ============== 1/ Deprecate the parent/children hierarchy on the res.company model. The fields are kept on the res.company model to ensure the retro-compatibility, but won't be used accross the standard code anymore. The only functional usage for this mechanism was to allow to see records from several companies by creating a virtual parent company, which will be possible with the new mechanism. 2/ By default, a user will only see the records of the company he is connected to (or records without a company). (It is still editable by the user if needed). For that, put this information in the user context, to allow having different configurations on different browser tabs. Instead of having domains like ['|', ('company_id', '=', False), ('company_id', 'child_of', user.company_id.id)] you'll have something like ['|', ('company_id', '=', False), ('company_id', 'in', company_ids)] Note that the 'company_ids' is a value that is passed in the evaluation context on the record rule, as we already have user, or time. company_ids is a list of the ids of all the enabled companies in the user's context. 3/ Out of the generic improvements brought by this task, this will illustrate issues that could exist since several versions. For example, it should not be possible to create a scrap order for the company A with a package of the company B, or it should not be possible to create an invoice on the company A with payment terms from the company B. Before the version 12.0, it was easy to encounter this kind of issues as the admin was the SUPERUSER_ID. A positive side effect of the fact that the SUPERUSER_ID has become an inactive user was to make it more difficult to introduce mismatch on the records, but haven't solved the issue, as it was still possible to do it with parent companies configuration. Some of these issues have been fixed in this commit, but all the business flows should be re-tested to check if an ir.rule should be introduced (eg: a multi company rule for stock.quand.package), if the company of a record is correctly transfered to another record created from the first record (eg: From a SO, create an invoice and a payment, the company of the sales order should be transfered on the invoice and the payment, even if the company of the sales order is A and I'm logged into the company B with the company A enabled. 4/ Currently, if I click on a button on a notification email (example 'View Task'), I face a traceback if I'm not logged into the company of the record. Now, if you click on a button and if you have access to the record, the correct company will be automatically set. 5/ If I display a kanban view with several records from several companies (and an image), all the images should be displayed. 6/ Currently if you copy paste an url, this will crash if you're not in the correct company. This won't be fixed because it's quite impossible to do it in a clean way. This task brings a workaround. Copy/Paste -> Traceback -> Log into the correct company, re-copy/paste -> Ok. 7/ 2 property methods have been added on the environment to retrieve the company on which the user is logged in and the companies the user enabled, on a specific tab. That way, when creating a record, instead of doing default=lambda self: self.env.user.company_id do default=lambda self: self.env.company_id On the other hand, to retrieve the enabled companies, do companies = self.env.company_ids 8/ Modify the Company Switcher widget to allow to log into another company WITHOUT writing on the res.users (and thus bringing cache invalidation issues and so on). Also allow to enable several companies and see records from several companies, and independantly of the other browser's tabs. 9/ When focusing on a tab, save the current company configuration on the local storage. That way, when doing 'CTRL+T' or a middle click, the context is propagated to the new tab. 10/ Improve the error message in case of multi company access errors. Now, when the user is in debug mode, display the related names of the records and the name of the user who brings the issue. 11/ Remove the context erasing when writing on a res.users This is probably coming from the migration to new API of the base module. The context was not propagated at this moment, which was a common mistake at that time. When migrating the module, probably by using the 'black box' method, as the context was not propagated, it was erased on the new version. This is now an issue because the context (i.e. the enabled companies) was erased when writing on a res.users, leading to tracebacks. See: https://github.com/odoo/odoo/commit/7eab8e26d3d46c53f4be924d6a34e80a66e74960#diff-4c2e738ee8f64f11806c889ea097b5e7R624 12/ Fix the crash manager on redirect warnings. The issue is the following - Create an invoice on a company without a configured CoA. - Set a partner - On the onchange_partner_id, a redirect warning is raised to propose you to configure a CoA - Click on 'Go to the configuration panel' - A generic warning says something like 'Do you want to discard your changes?' - Click on yes, the page refreshes, but not on the redirect action. Now, set correctly the action on the hash, and reload instead. The breadcrumb is lost for example, but you reach the correct action at least. 13/ Introduce a res.group to enable/disable the multi company per tab feature. 14/ To help the users to know which tab is in which company, add the possibility to have a favicon per company. When creating a company, the classical 'O' icon is colored by default in a random color. 15/ Remove the company switcher on the frontend. This was mainly there to allow a user to swicth to the company linked to the website. This behavior is now transparent to the user. If the website A is activated, then the company set on the context is the company of the website. 16/ Deprecated the _company_default_get method on the res.company model. Remove the method _get_company on the res.users model. 17/ Add 'allowed_company_ids' and 'current_company_id' on the pyeval context. You can now use those variables on domains in the views to access directly to the activated company.ies on the current tab. TaskID: 1960971 closes odoo/odoo#32341 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2019-04-24[IMP] web, *: share and improve notification systemqsm-odoo
* barcodes, calendar, partner_autocomplete, web_settings_dashboard Make the notification system better, using bootstrap toast component, and make it available in the frontend. The toast component allowed to remove some JS code and made the component customizable by themes but it had to be reviewed/fixed to make it functional (maybe bootstrap will review its work in next versions). This work should still be improved because there are still too many ways (deprecated and not deprecated) to instantiate toasts in the backend. The goal here was however to make the toasts more modern and make them available in the frontend. This work is needed for some tasks. @kig-odoo and @fja-odoo made a pre-work to instantiate toasts in the frontend for their respective tasks. This commit unifies the system. Part of https://github.com/odoo/odoo/pull/32793 task-1970731 closes odoo/odoo#32793 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2019-03-07[IMP] web: disable cache in debug assetsMartin Geubelle
When altering a view (regular or wizard's) in code/file (rather than via the client's interface) and restarting the server view caches don't get cleared and it's necessary to reload the entire client before the changes can be seen. This is annoying, and sometimes confusing so the cache is now disable in debug assets. Task 1911601 closes odoo/odoo#31667 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-03-06[IMP] web: don't swallow errors in async handlersAaron Bohy
This commit adds a 'guardedCatch' function to the Promise API. This function has to be used when we don't want to swallow real errors (crashes), like 'catch' does (i.e. basically all the time in Odoo). When the promise has been rejected because of a real error, the rejected Promises chain bubbles up to the top and triggers the 'unhandledrejection' event (triggered on all browsers thanks to the unhandled-rejection-polyfill lib). We then add a listener on that event to display real errors with the CrashManager. Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-01-28[MERGE] forward port branch saas-12.1 up to d3b8422c9c4Christophe Simonis
closes odoo/odoo#30614
2019-01-18[MERGE] forward port branch 12.0 up to f854e01a983Christophe Simonis
2019-01-11[FIX] web: add exponential backoff strategy for lost connectionGéry Debongnie
Before this commit, the web client had a naive strategy to handle lost connections: it tried to poll the server every 2 seconds until a rpc succeeds. This works quite well from the perspective of the user, but may be a problem from the perspective of the server. If a server is down for a longish period, then each users active tabs will then perform a request every 2 seconds. This means that the server will be progressively hammered by many requests, which will clutter the logs, and make it more difficult to gracefully recover. With this commit, we simply exponentially increase the delay each time, and add a little jitter to give a better distribution. closes odoo/odoo#30136
2018-12-07[REF] web: move ControlPanel inside controllers/actionsGéry Debongnie
This branch introduces a large-scale reorganization of the component tree generated by the web client. The short version is that now, the control panel is a child of the view controller and no longer a sibling. Graphically (and simplified), we go from this: webClient / | \ ... ... actionManager / \ controlPanel viewController / \ to this: webClient / | \ ... ... actionManager | viewController / | \ ControlPanelController / \ CPRenderer CPModel The motivation is that this work moves the code where it should be. Before this commit, it was kind of weird to have code in the controllers to render buttons outside of their root node (in renderButtons). Also, the action manager had to take care of coordinating search view states between view transitions. So, this work simplifies the code. It also makes it easier to extend. We see day after day that Odoo needs to take care of more complex UI needs, and in many cases, these needs were quite difficult to implement (we prefer spaghettis in our plates, not in our code). The changes in this branch should open the way to implement these features. For example, - it will now be easy to add the possibility of views (for example, the search view or a new ControlPanel view) to add custom buttons (of type action or object) in the control panel. - Another need will be to serialize/ restore the state of the search view across action boundaries (needed by the dashboard). - Another example is the possibility for views to customize easily the presence/absence of sub menus (filters/groupbys/favorites/ time range/...) - Another need is an easier way for views/client action to customize their control panel. This commit also contains a large rewrite of the search view (so it is more inline with our architecture and easier to maintain). Part of task 1893568 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
2018-12-11[FIX] *: JS doc/docstring errors & warningsXavier Morel
closes odoo/odoo#29439
2018-10-24[FIX] web: copy traceback in firefoxNicolas Lempereur
Same issue as in 902e484f1. In some browser (eg. firefox) the container parameter of ClipboardJS is needed if the focus is inside the modal so the copy work. See information on: https://github.com/zenorocha/clipboard.js/pull/368 opw-1902040 closes #28117
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-10[FIX] calendar: notifications may appearChristophe Matthieu
Following the transformation into notification service, performed by commit 07cd24b1ecf3ab8edd3fffbf2fcd3a3e685f357c, calendar has been forgotten.
2018-09-14[MERGE] forward port branch saas-11.4 up to 6c103589c15Christophe Simonis
2018-09-13[FIX] web: correct mobile screen size.Hiral Bhavsar
Revision on https://github.com/odoo/odoo/commit/d91ec258e6a31153beb9eb16cfe8f916546b7688 The commit above reverts a commit when we were using bootstrap 3. The equivalent of XS in bootstrap 3 is SM in bootstrap 4. So the correct revert with bootstrap 4 is to use SM. Also removing useless style on 'o_mobile_menu_opened'. Closes #26434
2018-09-10[FIX] web: ajax must return a promise with abort methodChristophe Matthieu
Remove part in service_mixins who hide this error. Queries must be able to be canceled for better performance. Also in the case of longpolling, if the request is not canceled, wait for a server message or the maximum time (30 sec) to add or delete channels.
2018-08-10[MERGE] forward port branch saas-11.4 up to edd586002e9Christophe Simonis
2018-08-09[IMP] web: remove useless service nameChristophe Matthieu
We use the registry keys as name for the services.