Skip to content

Instantly share code, notes, and snippets.

View yelizariev's full-sized avatar
Hello World!

Ivan Kropotkin yelizariev

Hello World!
View GitHub Profile
yelizariev /
Last active August 29, 2015 14:16
cd /usr/local/src/odoo
## delete matches="..." at /web/database/manager
sed -i 's/matches="[^"]*"//g' addons/web/static/src/xml/base.xml
## disable im_odoo_support
sed -i "s/'auto_install': True/'auto_install': False/" addons/im_odoo_support/
# PS1 for remote root
# \t \h \w\$
export PS1='\[\033[00;31m\]\t \[\033[01;31m\]\h \[\033[01;34m\]\w\[\033[01;31m\]\$\[\033[00m\] '
yelizariev /
Last active October 17, 2016 07:58
check and configure postgres
# connect to docker
docker exec -i --user=root -t db-9.5 /bin/bash
# inside docker
psql -U odoo
# inside psql
select datname, count(*) from pg_stat_activity group by datname;
yelizariev /
Last active December 1, 2016 06:54
Script to fix lint travis errors on odoo. OBSOLETE. Latest version is here:
# fix line break symbols
find * -type f | grep -v ".\(svg\|png\|jpg\)$" | xargs sed -i 's/\r//g'
# trim trailing whitespaces
find * -type f | grep -v ".\(svg\|png\|jpg\)$" | xargs sed -i 's/[ \t]*$//g'
#PEP8 для py-файлов:
autopep8 --in-place -r --aggressive --aggressive --ignore E501 ./
# fix CamelCase
yelizariev /
Last active March 17, 2017 05:37
Helpers for migrating to new odoo api (10.0+). Obsolete. Check for latest version here:
# replace osv, orm
find . -type f -name '*.py' | xargs sed -i 's/from openerp.osv import orm$/from odoo import models/g'
find . -type f -name '*.py' | xargs sed -i 's/from openerp.models.orm import Model$/from odoo.models import Model/g'
find . -type f -name '*.py' | xargs sed -i 's/osv.osv_memory/models.TransientModel/g'
find . -type f -name '*.py' | xargs sed -i 's/osv.osv/models.Model/g'
find . -type f -name '*.py' | xargs sed -i 's/osv.except_osv/UserError/g'
find . -type f -name '*.py' | xargs sed -i 's/osv\./models./g'
find . -type f -name '*.py' | xargs sed -i 's/\<orm\./models./g'
find . -type f -name '*.py' | xargs sed -i 's/\(import .*\), osv/\1, models/g'
# Installation:
sudo pip install PyGithub
# create token here: (you don't need to set any access checkboxes there)
# Usage
curl -s | python - --token=ABCDE \
"" \
yelizariev / nginx_odoo.conf
Last active May 10, 2017 11:51
How to deploy SaaS Demo
server {
listen 80;
#rewrite ^/.*$ https://$host$request_uri? permanent; #Uncomment this line in case you want to use https only
include odoo_params;
location /longpolling {
proxy_pass http://SERVER_HOST:8072;
cd /path/to/module/
# view source
find . -iname "*.py" -or -iname "*.xml" -or -iname "*.csv" -or -iname "*.yml" -or -iname "*.rst" -or -iname "*.md" | xargs tail -n +1 | less
# view source without docs
find . -iname "*.py" -or -iname "*.xml" -or -iname "*.csv" -or -iname "*.yml" | xargs tail -n +1 | less
# 8.0
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db-geo-8 camptocamp/postgres
docker run -d --name geo-8 -p 8069:8069 -p 8072:8072 -e ODOO_MASTER_PASS=master --link db-geo-8:db -v /root/odoo/odoo-8.0/geospatial/:/mnt/addons/extra/geospatial -t itprojectsllc/install-odoo:8.0 -- --db-filter=^%d$
docker exec -u odoo -i -t geo-8 /bin/bash -c "export UPDATE_ADDONS_PATH='yes'; bash /"
# 10.0
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db-geo-10 camptocamp/postgres
docker run -d --name geo-10 -p 8069:8069 -p 8072:8072 -e ODOO_MASTER_PASS=master --link db-geo-10:db -v /root/odoo/odoo-10.0/geospatial/:/mnt/addons/extra/geospatial -t itprojectsllc/install-odoo:10.0 -- --db-filter=^%d$
docker exec -u odoo -i -t geo-10 /bin/bash -c "export UPDATE_ADDONS_PATH='yes'; bash /"
git -C /root/odoo/odoo-10.0/geospatial/ pull upstream pull/146/head
yelizariev / odoo-performance.rst
Last active March 3, 2018 12:55
Performance optimization