Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

How to configure PyCharm for Odoo development in Windows.

By
Ibrar Ahmad
on 5/22/15, 4:03 PM 10,872 views

I want to configure pycharm in windows so that i could be able to create mudules from scaffold automatically. Then i can code it. Test it. and then run it automatically using run button.

4

Dhinesh - Technical Consultant, Sodexis Inc

--Dhinesh - Technical Consultant, Sodexis Inc--
3577
| 5 4 9
Pondicherry, India
--Dhinesh - Technical Consultant, Sodexis Inc--

Passionate coder in Python/OpenERP. Knows Django/Flask MVC frameworks. Did code in Java, PHP.

Contact me at: dvdhinesh.mail@gmail.com

Dhinesh - Technical Consultant, Sodexis Inc
On 5/23/15, 9:40 AM

Openerp in pycharm:

Create a new project:

File -> New project:

Location: -- Give your location (Similar to eclipse workspace)

Interpreter: python2.7

Adding source content in the new project:

File -> Settings;

In Project:{project_name} tab -> Project structure:

Add content root -> Select your different source folders.

In Appearance & Behaviour:

Keymap: Select Eclipse to get the same shortcut functionality as eclipse.

In Editor -> General -> Appearance: Enable show line numbers for debugging purpose.

Click Apply & Ok.

To create run configuration:

Run --> Edit Configurations, click "+" on the top left to create a new configuration with the following settings:

Name: openerp

Single instance checkbox: checked

Script: /opt/openerp/odoo.py

Script parameters: --config=/openerp-server.conf

Python interpreter: Python 2.7.6 (usr/bin/python2.7)

Working directory: /opt/openerp/pycharm/

To Add VCS integrations:

VCS -> Enable version control integration -> Select Subversion for openerp and Git for odoo incase you're working in git.

You can perform all RabbitVCS operations in pycharm itself.

Add external package:

External Libraries will be automatically loaded when you define interpreter. Incase you need to add extra library means,

Select Project -> File -> Settings -> Project:{project_name} tab -> Project Interpreter -> click "+" on the top left to add new packages.

Customizing Toolbar:

Enable toolbar from View -> Toolbar.

Right click toolbar -> Customize menu and toolbar -> Expand Main Toolbar.

Click any toolbar -> Add after -> Select any menu that needs to be appear in the toolbar.

You can use odoo or openerp, whatever you wish. This is the template i have been using for a while in linux. You could easily change it to windows. Only the source location gonna change.

Scaffold:

To perform scaffold operation pycharm has inbuilt terminal facility. you could go to odoo directory and issue the scaffold command to get it working. I hope you know the command for scaffolding.

Templates:

Usage video link: https://goo.gl/FXpspb

Github source link: https://github.com/mohamedmagdy/odoo-pycharm-templates (find the xml in attachments)

Just find the path: ~/.PyCharm40*/config/templates (in /home/harmony) and save the XML file there.

Invalidate cache and restart pycharm to make it work.

I followed these steps. But still I cann't import modules from openerp. any help please

Avini Wanigasinghe
on 10/7/15, 6:42 AM
0
Monchai P
On 9/6/16, 12:19 AM

I have tried this and there were many obstacles about Python and Windows API. The following are my problem and resolution.

1. You might know that PyCharm automatically run this statement for you.

    pip install -r requirements.txt   

  result:

     missing vcvarsall.bat for making gevent, psycopg2

  To solve this, download and install Microsoft Visual C++ Compiler for Python 2.7 at

https://www.microsoft.com/en-us/download/details.aspx?id=44266

  run this again

pip install -r requirements.txt

  someone recomment to run (I didn't know the reason behind, but I did it)

pip install --upgrade setuptools

2. Make sure you've already installed Postgresql and set your Odoo config file connect to the DB. For example, here is a part of my config file.

    db_host = localhost

    db_maxconn = 64

    db_name = False

    db_password = openpgpwd

    db_port = 5432

    db_template = template1

    db_user = openpg

    pg_path = C:\Program Files (x86)\Odoo 9.0-20160803\PostgreSQL\bin

3. Try to run your Odoo.py on PyCharm. If you encounter psyconpg2 error, try to reinstall it.

    pip uninstall psyconpg2

    pip install psyconpg2

4. The next problem you may have found is about pywin32. Just download and install Python for Windows Extensions at

    https://sourceforge.net/projects/pywin32/

5. Now your odoo.py should be able to run. Optional, if you want to set PyCharm (live)template as mentioned on the first answer. On Windows, the path to put Odoo.xml (template file) is a bit different.
    <your home directory>\.<product name><version number>\config\templates

for example

    C:\Users\John\.PyCharm2016.2\config\templates

if "templates" folder doesn't exist, create one.


My Environment
    OS:           Windows 10 Home 64bit  
    Python:   2.7.12 [MSC v.1500 32 bit (Intel)] on win32 run on 32bit
    Editor:     PyCharm Community Edition 2016.2.2

     Odoo:     9.0 Communication Source from GitHub
0
Ibrar Ahmad
On 5/26/15, 3:37 AM

Thaaaank you sooooooooooooo much bro. i am going to try it.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

3 follower(s)

Stats

Asked: 5/22/15, 4:03 PM
Seen: 10872 times
Last updated: 9/6/16, 12:19 AM