How I Setup PyCharm to Ease Odoo Development
A better way to develop
In the beginning, I’m developing Odoo modul with my basic IDE VS Code. But when I know that there is a better way to do with PyCharm Python IDE, I try it immediately. This is how I done.
If you need to know how I install odoo 12 in ubuntu 18.04, you can check my previous story.
Setup Run Configuration
In daily basis, I often to run stop re-run my Odoo to see the change that i made. If I did it with manual way in terminal, it will be too much time consuming. Luckily there is easy way to do.
- First, install PyCharm and run,
- Choose menu Run > Edit Configurations. Add new config (+)
- Set the configuration like mine. Script path is where is your odoo-bin located. And Parameters is where your custom addons located.
- Finally, I can run rerun and stop with a single click.
The more ease that you can get is you also can run Python console, terminal, git, and else in just the same window as the window where you run Odoo.
Use Auto Generate Odoo Template
With this template, I can auto generate class, object, fields, or an XML structure with just type odoo in your py/XML file.
- When I type it in Python file, i get these suggestion format.
- Besides, when it’s in XML file, I get this.
For example, I choose odoo_form then the generated XML will look like this
How to Install
- Download settings.jar file from github repo. Here
- Choose menu File > Manage IDE Settings > Import Setting in PyCharm. Then select the downloaded settings.jar file.
- PyCharm will give an option to restart, select it and the templates will be ready to use. If the option doesn’t appear, restart manually via File > Invalidate Chaches / Restart.
Get XML Change Without Upgrade
Often when I make some changes in XML, I have to upgrade module in App section. It’s get annoying and take time, especially if it done repeatedly. There’s a way to ease it.
- Go to Run > Edit Configurations.
- In Parameters, add this to the field.
Voila. You will save so much time.
That’s all how I done it. Happy Odoo development you all!