Skip to content

Instantly share code, notes, and snippets.

@akhdaniel
akhdaniel / Docker Ubuntu 20 Install COPAS.md
Last active January 31, 2024 10:46
Docker Ubuntu 20 Install COPAS

Installation Steps

sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
  "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
@akhdaniel
akhdaniel / README.md
Created April 27, 2021 02:48 — forked from tmilos/README.md
Modified Preorder Tree Traversal

Modified Preorder Tree Traversal

Hierarchical data metrics that allows fast read operations on tree like structures.

Based on Left and Right fields that are set during tree traversal. When entered into node value is set to it's Left, when exiting node value is set to it's Right.

Sample implementation

@akhdaniel
akhdaniel / Odoo docker compose
Created April 15, 2021 08:16
Odoo docker compose
### yml
version: '2'
services:
web:
image: odoo:11
depends_on:
- db
ports:
- "8069:8069"
volumes:
@akhdaniel
akhdaniel / Switching to another branch in git. Straightforward answer
Last active April 15, 2021 00:09
Switching to another branch in git. Straightforward answer
Switching to another branch in git. Straightforward answer,
git-checkout - Switch branches or restore working tree files
git fetch origin <----this will fetch the branch
git checkout branch_name <--- Switching the branch
Before switching the branch make sure you don't have any modified files, in that case, you can commit the changes or you can stash it.
CREATE OR REPLACE FUNCTION public.vit_duplicate_account_journal(v_account_journal_id INTEGER)
RETURNS void
LANGUAGE 'plpgsql'
COST 100
VOLATILE
AS $BODY$
DECLARE
v_account_journal record;

Backup db from odoo db manager inteface

the restore from command line:

pg_restore --format=c -U odoo -W -d <dbname> <backup_file.dump>

Backup manuyally

@akhdaniel
akhdaniel / make a Docker container start automatically on system boot.md
Last active February 22, 2025 06:54
make a Docker container start automatically on system boot

create systemctl service file

vim /etc/systemd/system/docker-odoo.service

file content is

@akhdaniel
akhdaniel / Template Stored Procedure Odoo.md
Last active February 3, 2021 09:03
Template Stored Procedure Odoo
from odoo import models, fields, api

import logging
_logger = logging.getLogger(__name__)



class account_move(models.Model):
    _name = 'account.move'
@akhdaniel
akhdaniel / odoo-pgpool.md
Last active December 9, 2021 18:45
Odoo + PGPOOL II

PG+PGPOOL docker compose file

version: '2'

networks:
  my-network:
    driver: bridge
services:
  pg-0:
@akhdaniel
akhdaniel / pgbouncer.ini
Created January 13, 2021 05:38 — forked from kenvac/pgbouncer.ini
basic pgbouncer configuration with odoo
;; database name = connect string
;;
;; connect string params:
;; dbname= host= port= user= password=
;; client_encoding= datestyle= timezone=
;; pool_size= connect_query=
[databases]
odoo1 = host=127.0.0.1 auth_user=odoo dbname=odoo1 port=5432
odoo2 = host=127.0.0.1 auth_user=odoo dbname=odoo2 port=5432
odoo3 = host=127.0.0.1 auth_user=odoo port=5432 dbname=odoo3