How to set up a development environment with PyCharm?
In the file manager
- virtualenv ./venv -p /usr/bin/python3.8/3.10 or python3.8/3.10 -m venv ./venv
- source ./venv/bin/activate
- pip3 install -r odoo/requirements.txt (If psycopg2 is version 2.7.1 in this file, set it to 184.108.40.206 first.)
- Change the standard Python interpreter of your project to the newly created environment ... File > Settings > Project: Odoo/[version].0 > Python Interpreter > Cog icon + Add > Select Odoo/[version].0/venv/bin/python3.8.
- Make a run configuration ...
- + Python
- Script path = Odoo/[version].0/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 or even different versions, it's a good idea to force the selection of the correct database by setting --db-filter=^database_name$ as a parameter.
- If you want your changes directly read from your XML files instead of from the database (as is the default behavior) you should add --dev=xml.
(Could not execute command 'lessc' => sudo apt-get install node-less!)
If you want to run Odoo via the Python Terminal use the following command ...
(venv) osadmin@osadmin-NJ50-70CU:~/OdooProjects/Odoo/[version].0/odoo$ python odoo-bin shell -d database_name --addons-path=addons,../enterprise,..
And now you can run inspect Odoo in the terminal like ...
self.name => 'Odoobot'