mirror of
https://github.com/docker/awesome-compose.git
synced 2025-04-26 10:43:35 +02:00
ADD Odoo development environment
This sample provides a basic setup to start developing applications for Odoo, it also includes a simple demo module. Closes #331 Signed-off-by: Alexander Olivares <alxolivares84@gmail.com>
This commit is contained in:
parent
e6b1d2755f
commit
6b077f2375
15 changed files with 271 additions and 0 deletions
117
odoo-postgres/README.md
Normal file
117
odoo-postgres/README.md
Normal file
|
@ -0,0 +1,117 @@
|
|||
## Compose sample
|
||||
|
||||
Odoo is a suite of open source business apps including, for example, CRM,
|
||||
eCommerce, accounting, etc. This example provides a basic setup to start
|
||||
developing applications.
|
||||
|
||||
For more information about how to use Odoo with Docker or how to deploy Odoo
|
||||
for production environment check the official Odoo [docker image](https://hub.docker.com/_/odoo/) page
|
||||
or the official Odoo [documentation](https://www.odoo.com/documentation/16.0/administration/install/deploy.html)
|
||||
page respectively.
|
||||
|
||||
Project structure:
|
||||
```shell
|
||||
odoo
|
||||
├── compose.yaml
|
||||
├── conf
|
||||
│ └── odoo.conf
|
||||
├── extra-addons
|
||||
│ └── contact_birthdate
|
||||
│ ├── __init__.py
|
||||
│ ├── __manifest__.py
|
||||
│ ├── models
|
||||
│ │ ├── __init__.py
|
||||
│ │ └── res_partner.py
|
||||
│ ├── README.md
|
||||
│ ├── static
|
||||
│ │ └── description
|
||||
│ │ └── icon.png
|
||||
│ └── views
|
||||
│ └── res_partner.xml
|
||||
├── output.png
|
||||
└── README.md
|
||||
```
|
||||
|
||||
> The *contact_birthdate* folder is a simple demo module that enables the
|
||||
> birthday date for individual type contacts.
|
||||
|
||||
[_compose.yaml_](compose.yaml)
|
||||
|
||||
```yml
|
||||
services:
|
||||
odoo:
|
||||
image: odoo:16.0
|
||||
platform: linux/amd64
|
||||
container_name: odoo
|
||||
...
|
||||
```
|
||||
|
||||
The compose file defines two services called odoo and postgres. When
|
||||
deploying, Docker Compose maps ports 8069 and 5432 of the odoo and
|
||||
postgres service containers to host ports 8069 and 5432, so make sure
|
||||
that both ports are not already being in use.
|
||||
|
||||
> The `tty: true` and `stdin_open: true` flags enable interactive mode,
|
||||
> this is especially useful if you want to use a Python debugger such
|
||||
> as `pdb`.
|
||||
|
||||
## Deploying with docker compose
|
||||
|
||||
```shell
|
||||
$ docker compose up -d
|
||||
[+] Running 5/5
|
||||
⠿ Network odoo_default Created
|
||||
⠿ Volume "odoo_odoo-data" Created
|
||||
⠿ Volume "odoo_psql-data" Created
|
||||
⠿ Container postgres Started
|
||||
⠿ Container odoo Started
|
||||
```
|
||||
|
||||
## Expected result
|
||||
|
||||
Listing containers must show two containers running and the port mapping as below:
|
||||
```shell
|
||||
$ docker ps
|
||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||
374a18da3b63 odoo:16.0 "/entrypoint.sh odoo" 2 minutes ago Up 2 minutes 0.0.0.0:8069->8069/tcp, 8071-8072/tcp odoo
|
||||
c3bbddf884d4 postgres:14.5 "docker-entrypoint.s…" 2 minutes ago Up 2 minutes 0.0.0.0:5432->5432/tcp postgres
|
||||
```
|
||||
|
||||
After the containers start, go to `http://localhost:8069` in your favorite web browser.
|
||||
|
||||

|
||||
|
||||
Once a new database is created, you will find the demo module along with all other
|
||||
available applications in the Apps menu.
|
||||
|
||||

|
||||
|
||||
To stop and remove the containers execute:
|
||||
|
||||
```shell
|
||||
$ docker compose down
|
||||
```
|
||||
|
||||
To remove the volumes execute:
|
||||
|
||||
```shell
|
||||
$ docker compose down -v
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If you are running docker on a Mac with an Apple chip you may get the
|
||||
following error message when trying to pull the odoo image:
|
||||
|
||||
```shell
|
||||
Using default tag: latest
|
||||
latest: Pulling from library/odoo
|
||||
no matching manifest for linux/arm64/v8 in the manifest list entries
|
||||
```
|
||||
|
||||
This is because there is no *linux/arm64* image available yet, so to avoid
|
||||
this problem you must explicitly specify in the compose file the platform
|
||||
to use as follow: `platform: linux/amd64`.
|
||||
|
||||
There is an open [issue](https://github.com/odoo/docker/issues/349) related
|
||||
to this subject on GitHub.
|
33
odoo-postgres/compose.yaml
Normal file
33
odoo-postgres/compose.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
services:
|
||||
odoo:
|
||||
image: odoo:16.0
|
||||
platform: linux/amd64
|
||||
container_name: odoo
|
||||
depends_on:
|
||||
- postgres
|
||||
tty: true
|
||||
stdin_open: true
|
||||
ports:
|
||||
- "8069:8069"
|
||||
environment:
|
||||
- HOST=postgres
|
||||
volumes:
|
||||
- odoo-data:/var/lib/odoo
|
||||
- ./conf:/etc/odoo
|
||||
- ./extra-addons:/mnt/extra-addons
|
||||
postgres:
|
||||
image: postgres:14.5
|
||||
platform: linux/amd64
|
||||
container_name: postgres
|
||||
ports:
|
||||
- "5432:5432"
|
||||
environment:
|
||||
- POSTGRES_DB=postgres
|
||||
- POSTGRES_PASSWORD=odoo
|
||||
- POSTGRES_USER=odoo
|
||||
- PGDATA=/var/lib/postgresql/data/pgdata
|
||||
volumes:
|
||||
- psql-data:/var/lib/postgresql/data/pgdata
|
||||
volumes:
|
||||
odoo-data:
|
||||
psql-data:
|
37
odoo-postgres/conf/odoo.conf
Normal file
37
odoo-postgres/conf/odoo.conf
Normal file
|
@ -0,0 +1,37 @@
|
|||
[options]
|
||||
addons_path = /mnt/extra-addons
|
||||
data_dir = /var/lib/odoo
|
||||
; admin_passwd = secretpass
|
||||
; csv_internal_sep = ,
|
||||
; db_maxconn = 64
|
||||
; db_name = False
|
||||
; db_template = template1
|
||||
; dbfilter = .*
|
||||
; debug_mode = False
|
||||
; email_from = False
|
||||
; limit_memory_hard = 2684354560
|
||||
; limit_memory_soft = 2147483648
|
||||
; limit_request = 8192
|
||||
; limit_time_cpu = 60
|
||||
; limit_time_real = 120
|
||||
; list_db = True
|
||||
; log_db = False
|
||||
; log_handler = [':INFO']
|
||||
; log_level = info
|
||||
; logfile = None
|
||||
; longpolling_port = 8072
|
||||
; max_cron_threads = 2
|
||||
; osv_memory_age_limit = 1.0
|
||||
; osv_memory_count_limit = False
|
||||
; smtp_password = False
|
||||
; smtp_port = 25
|
||||
; smtp_server = localhost
|
||||
; smtp_ssl = False
|
||||
; smtp_user = False
|
||||
; workers = 0
|
||||
; xmlrpc = True
|
||||
; xmlrpc_interface =
|
||||
; xmlrpc_port = 8069
|
||||
; xmlrpcs = True
|
||||
; xmlrpcs_interface =
|
||||
; xmlrpcs_port = 8071
|
30
odoo-postgres/extra-addons/contact_birthday/README.rst
Normal file
30
odoo-postgres/extra-addons/contact_birthday/README.rst
Normal file
|
@ -0,0 +1,30 @@
|
|||
===================
|
||||
Contact's birthday
|
||||
===================
|
||||
|
||||
This module enables the birthday date for individual type contacts.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
There is no need for any additional configuration to enable this feature.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Go to Contacts, then select a contact and set the birthday date.
|
||||
|
||||
.. image:: static/description/image_01.png
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* Alexander Olivares <alexanderolivares@gmail.com>
|
3
odoo-postgres/extra-addons/contact_birthday/__init__.py
Normal file
3
odoo-postgres/extra-addons/contact_birthday/__init__.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
19
odoo-postgres/extra-addons/contact_birthday/__manifest__.py
Normal file
19
odoo-postgres/extra-addons/contact_birthday/__manifest__.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
"name": "Contact's birthday",
|
||||
|
||||
"author": "Alexander Olivares",
|
||||
"website": "https://github.com/alxolivares",
|
||||
|
||||
"category": "Hidden",
|
||||
"version": "0.1",
|
||||
|
||||
"depends": ["contacts"],
|
||||
|
||||
"data": ["views/res_partner.xml"],
|
||||
|
||||
"demo": ["demo/res_partner.xml"],
|
||||
|
||||
"installable": True,
|
||||
"license": "AGPL-3",
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="base.res_partner_address_28" model="res.partner">
|
||||
<field name="birthday_date" eval="DateTime.now()"/>
|
||||
</record>
|
||||
</odoo>
|
|
@ -0,0 +1,3 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import res_partner
|
|
@ -0,0 +1,9 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
birthday_date = fields.Date(
|
||||
string="Birthday", help="Contact's birthday date")
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 352 KiB |
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="name">view.partner.form.inherit</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='vat']" position="after">
|
||||
<field name="birthday_date" attrs="{'invisible': [('is_company','=',True)]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
BIN
odoo-postgres/output_01.png
Normal file
BIN
odoo-postgres/output_01.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 277 KiB |
BIN
odoo-postgres/output_02.png
Normal file
BIN
odoo-postgres/output_02.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 226 KiB |
Loading…
Add table
Add a link
Reference in a new issue