fa854232ff8718de28c0b7f1819ad30320b843aa
Before 16.0 and the website-in-backend refactoring made at [1], the publish button of the frontend had this behavior: - The record is unpublished - Click on the publish button -> a rpc to publish is sent but the switch visual state is not updated (the internal checkbox is still unchecked) - The rpc comes back with the response -> the switch visual state is updated (red -> green) This is actually the behavior since the bug fix made at [2]. The main point of this commit was to prevent toggling the checkbox while its javascript behavior was not initialized yet. From 16.0, that loading problem is not an issue anymore, as the publish button is instantiated client side and thus only appears when it is possible to use. We can thus update the visual switch state as soon as the user click on it for a better UX. However, that was flawed: 1. If the publish action actually failed, the switch was kept checked/unchecked while it should be reverted to unchecked/checked. 2. If you clicked very fast multiple times on the button, many RPC were sent and their result order was not guaranteed. 3. There is no possibility for tours to wait for the actual publish action to be done... and that will be needed in a further commit of this PR. This commit fixes all those flaws: 1. If the RPC fails, we now revert to the status before the user clicked on it. Inspired by [2], the internal checkbox is now disabled, which leaves its status entirely up to OWL instead of browser behaviors. 2. The switch now stops listening to clicks while a RPC is being performed. 3. While a RPC is being performed a "data-processing" attribute is added to the whole switch area. Note: in master, the whole switch system should be reviewed. The publish button one's structure actually makes no sense: a <div> which contains a <a> which contains a <label> (already invalid DOM), with the <div> being the event handler of the switch status changes... [1]: https://github.com/odoo/odoo/commit/31cc10b91dc7762e23b4bde9b945be0c4ce3fe3b [2]: https://github.com/odoo/odoo/commit/2e751d80dd4b23abf374d5aa488827faaa593e62 Related to task-3129034 X-original-commit: 36a8fe44d6ec609a9bad8d960768766a44d4074e Part-of: odoo/odoo#111289
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%