diff --git a/README.md b/README.md index 50076f9be..f4e796601 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ application with a Rust backend and a Postgres database. Use with Docker Dev Environments - [`WasmEdge / MySQL / Nginx`](wasmedge-mysql-nginx) - Sample Wasm-based web application with a static HTML frontend, using a MySQL (MariaDB) database. The frontend connects to a Wasm microservice written in Rust, that runs using the WasmEdge runtime. Compatible with Docker+wasm - [`WasmEdge / Kafka / MySQL`](wasmedge-kafka-mysql) - Sample Wasm-based microservice that subscribes to a Kafka (Redpanda) queue topic, and transforms and saves any incoming message into a MySQL (MariaDB) database. Compatible with Docker+wasm +- [`Odoo / PostgreSQL`](odoo-postgres) - This sample provides a basic setup to start developing applications for Odoo, it also includes a simple demo module. ## Single service samples diff --git a/odoo-postgres/README.md b/odoo-postgres/README.md new file mode 100644 index 000000000..45a7f22cf --- /dev/null +++ b/odoo-postgres/README.md @@ -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. + +![page](output_01.png) + +Once a new database is created, you will find the demo module along with all other +available applications in the Apps menu. + +![page](output_02.png) + +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. diff --git a/odoo-postgres/compose.yaml b/odoo-postgres/compose.yaml new file mode 100644 index 000000000..8a0d9bc64 --- /dev/null +++ b/odoo-postgres/compose.yaml @@ -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: diff --git a/odoo-postgres/conf/odoo.conf b/odoo-postgres/conf/odoo.conf new file mode 100644 index 000000000..dc308043a --- /dev/null +++ b/odoo-postgres/conf/odoo.conf @@ -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 diff --git a/odoo-postgres/extra-addons/contact_birthday/README.rst b/odoo-postgres/extra-addons/contact_birthday/README.rst new file mode 100644 index 000000000..07c8e3f59 --- /dev/null +++ b/odoo-postgres/extra-addons/contact_birthday/README.rst @@ -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 diff --git a/odoo-postgres/extra-addons/contact_birthday/__init__.py b/odoo-postgres/extra-addons/contact_birthday/__init__.py new file mode 100644 index 000000000..cde864bae --- /dev/null +++ b/odoo-postgres/extra-addons/contact_birthday/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/odoo-postgres/extra-addons/contact_birthday/__manifest__.py b/odoo-postgres/extra-addons/contact_birthday/__manifest__.py new file mode 100644 index 000000000..2e255e88d --- /dev/null +++ b/odoo-postgres/extra-addons/contact_birthday/__manifest__.py @@ -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", +} diff --git a/odoo-postgres/extra-addons/contact_birthday/demo/res_partner.xml b/odoo-postgres/extra-addons/contact_birthday/demo/res_partner.xml new file mode 100644 index 000000000..1e57ca90e --- /dev/null +++ b/odoo-postgres/extra-addons/contact_birthday/demo/res_partner.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/odoo-postgres/extra-addons/contact_birthday/models/__init__.py b/odoo-postgres/extra-addons/contact_birthday/models/__init__.py new file mode 100644 index 000000000..f261da797 --- /dev/null +++ b/odoo-postgres/extra-addons/contact_birthday/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import res_partner diff --git a/odoo-postgres/extra-addons/contact_birthday/models/res_partner.py b/odoo-postgres/extra-addons/contact_birthday/models/res_partner.py new file mode 100644 index 000000000..17cbb9c4d --- /dev/null +++ b/odoo-postgres/extra-addons/contact_birthday/models/res_partner.py @@ -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") diff --git a/odoo-postgres/extra-addons/contact_birthday/static/description/icon.png b/odoo-postgres/extra-addons/contact_birthday/static/description/icon.png new file mode 100644 index 000000000..840a92dcc Binary files /dev/null and b/odoo-postgres/extra-addons/contact_birthday/static/description/icon.png differ diff --git a/odoo-postgres/extra-addons/contact_birthday/static/description/image_01.png b/odoo-postgres/extra-addons/contact_birthday/static/description/image_01.png new file mode 100644 index 000000000..feb1d5b07 Binary files /dev/null and b/odoo-postgres/extra-addons/contact_birthday/static/description/image_01.png differ diff --git a/odoo-postgres/extra-addons/contact_birthday/views/res_partner.xml b/odoo-postgres/extra-addons/contact_birthday/views/res_partner.xml new file mode 100644 index 000000000..3758a5fa0 --- /dev/null +++ b/odoo-postgres/extra-addons/contact_birthday/views/res_partner.xml @@ -0,0 +1,13 @@ + + + + view.partner.form.inherit + + res.partner + + + + + + + diff --git a/odoo-postgres/output_01.png b/odoo-postgres/output_01.png new file mode 100644 index 000000000..696dfd41a Binary files /dev/null and b/odoo-postgres/output_01.png differ diff --git a/odoo-postgres/output_02.png b/odoo-postgres/output_02.png new file mode 100644 index 000000000..88b191825 Binary files /dev/null and b/odoo-postgres/output_02.png differ