Create dev environment » History » Version 5
Olivier Bitsch, 03/26/2024 08:56 AM
1 | 3 | Olivier Bitsch | # Create dev environment with OCA |
---|---|---|---|
2 | 1 | Olivier Bitsch | |
3 | 3 | Olivier Bitsch | ## Requirements |
4 | 1 | Olivier Bitsch | |
5 | 3 | Olivier Bitsch | We assume you already have: |
6 | |||
7 | - VScode installed |
||
8 | - Python3 installed |
||
9 | - You have PostGreSQL |
||
10 | |||
11 | ## Setup process |
||
12 | |||
13 | ### Clone Odoo |
||
14 | |||
15 | Create an empty folder. If you plan to work with several odoo versions, you should create a folder with version name (e.g. odoo17). |
||
16 | |||
17 | > Due to virtual environment, don't rename or move this folder. |
||
18 | |||
19 | 1 | Olivier Bitsch | ``` |
20 | BRANCH=17.0 |
||
21 | git clone --depth=1 --branch ${BRANCH} --single-branch https://github.com/odoo/odoo |
||
22 | ``` |
||
23 | |||
24 | 4 | Olivier Bitsch | ### Install virtual environment |
25 | |||
26 | 1 | Olivier Bitsch | Create virtualenv and install dependancies |
27 | |||
28 | ``` |
||
29 | python3 -m venv venv |
||
30 | . ./venv/bin/activate |
||
31 | pip install -r odoo/requirements.txt |
||
32 | 2 | Olivier Bitsch | ``` |
33 | 1 | Olivier Bitsch | |
34 | 4 | Olivier Bitsch | ### Add OCA packages |
35 | |||
36 | To install OCA packages, download the xz file corresponding to your odoo version here (check you have the latest version) |
||
37 | 2 | Olivier Bitsch | https://projects.iabsis.com/projects/odoo-oca/files |
38 | 3 | Olivier Bitsch | |
39 | 2 | Olivier Bitsch | Extract into your project root folder and name it "oca", it should containing all oca addons. |
40 | 1 | Olivier Bitsch | |
41 | 4 | Olivier Bitsch | ### Create odoo.conf config and empty dev folder for your new modules |
42 | |||
43 | 1 | Olivier Bitsch | Now copy odoo.conf config file into your root folder |
44 | 2 | Olivier Bitsch | |
45 | ``` |
||
46 | 1 | Olivier Bitsch | cp odoo/debian/odoo.conf odoo.conf |
47 | 4 | Olivier Bitsch | mkdir dev |
48 | ``` |
||
49 | |||
50 | Edit the file to be able to connect on PostGreSQL. Also update the addons_path, you should have something like that: |
||
51 | |||
52 | ``` |
||
53 | addons_path = dev,oca,odoo/addons |
||
54 | db_password = odoo |
||
55 | db_port = 5432 |
||
56 | db_template = template0 |
||
57 | db_user = odoo |
||
58 | ``` |
||
59 | ### Add Debug configuration in Vscode |
||
60 | |||
61 | From Vscode, press `CTRL+SHIFT+P` and search for "Debug: add configuration...". Paste the following debug profile. |
||
62 | |||
63 | ``` |
||
64 | { |
||
65 | "version": "0.2.0", |
||
66 | "configurations": [ |
||
67 | { |
||
68 | "name": "Odoo17", |
||
69 | "type": "debugpy", |
||
70 | "request": "launch", |
||
71 | "program": "odoo/odoo-bin", |
||
72 | "console": "integratedTerminal", |
||
73 | "justMyCode": true, |
||
74 | "args": [ |
||
75 | "-c", |
||
76 | "odoo.conf", |
||
77 | "--limit-time-real", |
||
78 | "99999", |
||
79 | "--log-handler", |
||
80 | "odoo.tools.convert:DEBUG" |
||
81 | ], |
||
82 | } |
||
83 | ] |
||
84 | } |
||
85 | 2 | Olivier Bitsch | ``` |
86 | 5 | Olivier Bitsch | |
87 | ### It's ready |
||
88 | |||
89 | Now simply click on the green start from debug panel. |