How to set up a development environment with PyCharm?

  • type
      technical
  • info created for version
      8.0 , 9.0 , 10.0 , 11.0 , 12.0 , 13.0 , 14.0
Add to Cart

  • Create an Odoo? folder and clone Odoo with the command git clone --depth 1 --branch ?.0 git@github.com:odoo/odoo.git.
  • Create a virtual environment in that folder (with Python3 since Odoo 11) ...
    • virtualenv ./venv -p /usr/bin/python(3)
    • source ./venv/bin/activate
    • pip(3) install -r odoo/requirements.txt (If psycopg2 is version 2.7.1 in this file, set it to 2.7.3.1 first.)
    • deactivate
  • Open the Odoo? folder in PyCharm ...
    • Change the standard Python interpreter of your project to the newly created environment ... File > Settings > Project: Odoo? > Python Interpreter > Cog icon + Add > Select Odoo?/venv/bin/python(2.7).
    • Make a run configuration ...
      • + Python
      • Script path = Odoo?/odoo/odoo -bin (or openerp-server before Odoo10)
      • Parameters (do not copy/paste these params, the format could be wrong ... they should start with two hyphens)
        • Odoo should be able to connect to your database, so make sure the params --db_user and --db_password are correctly set.
        • If you have more environments of Odoo of even different versions, it's a good idea to force the selection of the correct database by setting --db-filter=^Odoo?$ as parameter.
        • If you want your changes directly read from your xml files instead of from the database (as is default behaviour) you should add --dev=xml.