Skip to content

Commit

Permalink
Merge pull request #82 from coopdevs/refresh-server-when-code-changes
Browse files Browse the repository at this point in the history
Refresh server when the code changes
  • Loading branch information
enricostano authored Jun 10, 2020
2 parents 13ba24e + 18f1a9a commit 240c198
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,13 @@ odoo_role_odoo_core_modules: "base"
odoo_role_odoo_community_modules: ""
```
* Development mode
Odoo has a mode to auto-reload the server when the code changes and read the views from the code to agile the development process. Using the command line parameter [`--dev`](https://www.odoo.com/documentation/12.0/reference/cmdline.html#developer-features) we can run Odoo in a development mode.
```yaml
odoo_role_dev_mode: true
```

Community Roles
---------------

Expand Down
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ odoo_daemon: "odoo.service"
# Whether to populate db with example data or not.
odoo_role_demo_data: false

# Start the server in development mode: https://www.odoo.com/documentation/12.0/reference/cmdline.html#developer-features
odoo_role_dev_mode: false

# HTTP server settings
odoo_role_odoo_http_interface: "127.0.0.1"
odoo_role_odoo_proxy_mode: true
8 changes: 8 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,12 @@
with_items: "{{ odoo_role_odoo_dbs }}"
notify: restart odoo

- name: Install whatchdog in development environment
become: yes
become_user: "{{ odoo_role_odoo_user }}"
pip:
name: watchdog
virtualenv: "{{ odoo_role_odoo_venv_path }}"
when: odoo_role_dev_mode | bool

- import_tasks: add-service.yml
3 changes: 2 additions & 1 deletion templates/odoo.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
Description=Odoo server

[Service]
ExecStart={{ odoo_role_odoo_python_path }} {{ odoo_role_odoo_bin_path }} -c {{ odoo_role_odoo_config_path }}/odoo.conf
ExecStart={{ odoo_role_odoo_python_path }} {{ odoo_role_odoo_bin_path }} -c {{ odoo_role_odoo_config_path }}/odoo.conf {% if odoo_role_dev_mode %} --dev all {% endif %}

# Execute service like user
User={{ odoo_role_odoo_user }}
Group={{ odoo_role_odoo_group }}
Expand Down

0 comments on commit 240c198

Please sign in to comment.