Skip to content

Instantly share code, notes, and snippets.

View moylop260's full-sized avatar

Moisés López - https://www.vauxoo.com/ moylop260

View GitHub Profile
@moylop260
moylop260 / apt_list.txt
Last active October 24, 2022 20:30
Odoo requirements for Odoo v16.0 from odoo.sh extracted with "pip freeze", psql version & apt list
# apt list --installed
Listing...
adduser/jammy,now 3.118ubuntu5 all [installed]
adwaita-icon-theme/jammy,now 41.0-1ubuntu1 all [installed,automatic]
alsa-topology-conf/jammy,now 1.2.5.1-2 all [installed,automatic]
alsa-ucm-conf/jammy,now 1.2.6.3-1ubuntu1 all [installed,automatic]
antiword/jammy,now 0.37-16 amd64 [installed]
apparmor/jammy,now 3.0.4-2ubuntu2 amd64 [installed,automatic]
apt-utils/jammy,now 2.4.5 amd64 [installed]
apt/jammy,now 2.4.5 amd64 [installed]
@moylop260
moylop260 / docker_remove_exited_containers.py
Last active September 1, 2022 15:39
script to remove exited containers
# https://docker-py.readthedocs.io/en/stable/containers.html
import docker
cli = docker.from_env()
all_containers = cli.containers.list(True)
exited_containers = [i for i in all_containers if i.status == 'exited']
[i.remove(v=True,force=True) for i in exited_containers]
@moylop260
moylop260 / odoo_db2pg_variable.sh
Last active May 18, 2023 23:55
Odoo configuration file transform "DB_" variables to "PG" environment variables env postgresql postgres
eval $(sed -E 's/[a-z_ ]+ = /\U&/g;s/ //g;s/DB_/export PG/g' /home/odoo/.openerp_serverrc |grep export)
# psql -l |grep postg
# > psql: error: could not connect to server
# eval $(sed -E 's/[a-z_]+ = /\U&/g;s/ //g;s/DB_/export PG/g' /home/odoo/.openerp_serverrc |grep export)
# psql -l |grep postg
# > postgres | postgres | UTF8 | C | C.UTF-8 |
brew install openssl zlib
alias pyenv_install_py37='env SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk" CFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX11.0.sdk/usr/include" CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/zlib/include" LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/zlib/lib" pyenv install 3.7.8'
#!/bin/bash
# Create a docker-machine in the client side
# Before install docker-maching https://docs.docker.com/machine/install-machine/
export SERVER_IP=192.168.1.X
export SSH_USER=hbto
export MACHINE_NAME=${USER}pc
export SSH_PORT=22
export DOCKER_PORT=2376
echo '${SERVER_IP} ${MACHINE_NAME}' | sudo tee -a /etc/hosts # Si cambia esta IP, hay que actualizar este archivo también
docker-machine create --driver generic --generic-ip-address=${MACHINE_NAME} --generic-ssh-user=${SSH_USER} --generic-ssh-port=${SSH_PORT} --generic-engine-port=${DOCKER_PORT} ${MACHINE_NAME}
odoo/odoo/addons/account/i18n/zh_CN.po:1398:0: W7968: Translation string couldn't be parsed correctly using string.format() KeyError('%') (po-msgstr-variables)
odoo/odoo/addons/account/i18n/mn.po:3577:0: W7968: Translation string couldn't be parsed correctly using string%variables TypeError('not all arguments converted during string formatting') (po-msgstr-variables)
odoo/odoo/addons/base_import_module/i18n/tr.po:42:0: W7968: Translation string couldn't be parsed correctly using string%variables TypeError('not all arguments converted during string formatting') (po-msgstr-variables)
odoo/odoo/addons/crm_livechat/i18n/mn.po:33:0: W7968: Translation string couldn't be parsed correctly using string%variables TypeError('not all arguments converted during string formatting') (po-msgstr-variables)
odoo/odoo/addons/hr_holidays/i18n/zh_CN.po:2944:0: W7968: Translation string couldn't be parsed correctly using string%variables TypeError('not all arguments converted during string formatting') (po-msgstr-variables)
from odoo import models
class TestSQLInjection(models.Model):
_name = 'test.sql.injection'
def get_params(self):
pass
def _get_params(self):
# rgrep "\.clear_caches()" . --include=*.py --exclude-dir=test*
./odoo/tools/translate.py:1161: Translation.clear_caches()
./odoo/addons/base/models/ir_default.py:27: self.clear_caches()
./odoo/addons/base/models/ir_default.py:33: self.clear_caches()
./odoo/addons/base/models/ir_default.py:39: self.clear_caches()
./odoo/addons/base/models/ir_property.py:115: self.clear_caches()
./odoo/addons/base/models/ir_property.py:124: self.clear_caches()
./odoo/addons/base/models/ir_property.py:138: self.clear_caches()
./odoo/addons/base/models/res_lang.py:218: self.clear_caches()
./odoo/addons/base/models/res_lang.py:233: self.clear_caches()
`rgrep "ormcache(" . --include=*.py --exclude-dir=test* -A4 |grep "\- def "`
odoo 12.0:
./odoo/models.py-630- def _is_an_ordinary_table(self):
./odoo/models.py-633- def __ensure_xml_id(self, skip=False):
./odoo/models.py-2365- def _table_has_rows(self):
./odoo/addons/base/models/ir_default.py-126- def get_model_defaults(self, model_name, condition=False):
./odoo/addons/base/models/ir_property.py-186- def _get_default_property(self, name, model):
./odoo/addons/base/models/res_lang.py-184- def _lang_get_id(self, code):
./odoo/addons/base/models/res_lang.py-195- def _data_get(self, monetary=False):