In this blog, we are going to discuss how we can save time and simplify a custom module development using the pycharm templates. Usually, we may spend a lot of time building the basic structure including manifest, python and view files. Most of the developers are following a method of copying the required files from the existing modules, later redefining it the way they need. It is seen rarely the developers adopting manual typing.
Odoo Pycharm templates help the developers to develop Odoo modules faster and with no Typing Errors.
Odoo Pycharm templates can be installed in two ways
1. Installation from “settings.jar”.
2. Manual Installation.
First, we can look towards the installation using the “settings.jar” and how it will help us during the odoo development.
> You can install settings.jar from the following link Odoo-Pycharm template.
> After downloading the file, go to your Pycharm -> Files -> Import settings.
From this, we can import the “settings.jar” file which we downloaded earlier.
> After importing Go to File | Invalidate Caches / Restart the pycharm in the latest versions of pycharm there will be a popup asking for restart automatically.
> After restarting the Pycharm, our Odoo-Pycharm installation will be completed.
Now we can check the use of odoo-pycharm templates in module development.
Basic Python
1. Loading template of the manifest (odoo_manifest)
Input:
Output:
2. Loading import (odoo_import)
Input:
Output:
3. Loading class and objects(odoo_object and odoo_object_inherit)
Input:
Output:
> odoo_object
> odoo_object_inherit
Common Python Functions
1. Loading onchange and compute function (odoo_onchange , odoo_method_onchange and odoo_method_compute_field)
Input:
> odoo_onchange
Output:
Input:
> odoo_method_onchange
Output:
Input:
> odoo_method_compute_field
Output:
These are some of the important use of the pycharm template in odoo python. These templates also offer the option for declaring all types of fields such as Many2one(odoo_field_many2one), Many2many(odoo_field_many2many).
Some of the keywords which can use in views(.xml)
1. odoo_menuitem_root (For creating Parent menu item)
2. odoo_menuitem_action (For creating Sub-menu)
3. odoo_view_action (For creating action)
4. odoo_search (For creating search view)
5. odoo_tree (For creating new tree views)
6. odoo_tree_inherit (For creating inherited tree views)
7. odoo_form (For new form views)
8. odoo_form_inherit (For creating inherited form views)
9. odoo_security_rule (For creating the security rule)
Manual Installation and template customization
1. We will get the XML file of the template by extracting the settings.jar(odoo.xml)
2. Move the Odoo.xml file to templates of PyCharm IDE.
-In ubuntu
Path: ~/.PyCharm*/config/templates
-In Windows
Path: ~/Library/Preferences/PyCharm*/templates
3. After moving the file restart the pycharm and then we can use the odoo templates in pycharm, we can also customize the templates by editing the odoo.xml file