官术网_书友最值得收藏!

Enabling the developer mode

To implement our project, we need the tools provided by the developer mode, which needs to be enabled.

The developer mode allows us to customize Odoo apps directly from the user interface. This has the advantage of being a rather quick way to make changes and add features. It can be used from small modifications, such as adding a field, to larger customizations, such as creating an application with several models, views, and menu items.

These customizations done directly from the user interface have some limitations, when compared to the customizations done with programming tools, covered throughout the rest of the book. For example, you can't add or extend the default ORM methods (although in some cases automated actions can be enough to provide an alternative to that). They also can't be easily integrated into a structured development workflow, which typically involves version control, automated tests, and deploying into several environments, such as quality assurance, pre-production, and production.

Here, we will be using the developer mode features mainly as a way to introduce how application configuration data is organized in the Odoo framework, and how the developer mode can be leveraged for simple customizations, or to quickly outline or prototype the solution to implement.

To enable the developer mode, go to Settings | Dashboard, and in the lower-right corner you should find the Activate the developer mode link. Clicking on it enables the developer mode features for this browser window. For Odoo 9.0 and before, the developer mode is activated in the About dialog window, available from the User menu, in the upper-right corner of the web client. 

We also have available an Activate the developer mode (with assets) option. What it does is prevent web client asset minification. It is useful to debug the web client itself, at the expense of making the navigation a little slower.

For faster load times, the web client minifies the JavaScript and CSS assets into compact files. Unfortunately, that makes web client debugging nearly impossible. The Activate the developer mode (with assets) option prevents this minification and loads the web assets in individual, non-minified files.

The developer mode can also be enabled by tinkering directly with the current URL, so that you don't have to leave your current screen to open settings. Edit the URL to change the .../web#... part to insert .../web?debug#... or .../web?debug=assets#.... For example, http://localhost:8069/web#home would be changed to http://localhost_8069/web?debug#home.

Although there is no link to enable it, the frontend framework also supports the debug flag. To disable asset minification in a frontend web page, add ?debug=assets to the corresponding URL. Take note that the option will probably not persist when navigating through links to other frontend pages.

There are browser extensions available for both Firefox and Chrome that provide a convenient button to enable and disable the developer mode. Look for "Odoo debug" in Firefox add-ons or the Chrome store.

Once the developer mode is enabled, we will see two additional menus available:

  1. The Developer Tools menu, the bug icon on the right-hand side of the top menu bar, just before the username and avatar
  2. The Technical menu item, in the Settings application

The following screenshot shows the two additional menus:

The developer mode also enables additional information on form fields; when pausing the mouse pointer over a field, a tooltip will display technical information on it.

We will be using the most relevant developer mode features in the next sections.

主站蜘蛛池模板: 东阳市| 冕宁县| 济阳县| 赤水市| 新兴县| 乌兰县| 乌苏市| 红河县| 高唐县| 萍乡市| 克什克腾旗| 柘荣县| 军事| 石柱| 桂东县| 梨树县| 山丹县| 厦门市| 文化| 京山县| 赤城县| 团风县| 大理市| 林州市| 河东区| 武川县| 绵阳市| 库伦旗| 仪征市| 信宜市| 平阳县| 五华县| 望城县| 娄底市| 滕州市| 湘潭县| 吉水县| 济南市| 柏乡县| 景泰县| 广河县|