Skip to content

Instantly share code, notes, and snippets.

View odony's full-sized avatar

Olivier Dony (ODO) odony

View GitHub Profile
@odony
odony / Community.txt
Last active September 27, 2018 12:11
Outdated POT files
addons/l10n_ch/i18n_extra/l10n_ch.pot:770:#: model:ir.ui.view,arch_db:l10n_ch.l10n_ch_isr_report_template
addons/l10n_ch/i18n_extra/l10n_ch.pot:780:#: model:ir.ui.view,arch_db:l10n_ch.isr_invoice_search_view
addons/l10n_ch/i18n_extra/l10n_ch.pot:1011:#: model:ir.ui.view,arch_db:l10n_ch.isr_invoice_form
addons/l10n_ch/i18n_extra/l10n_ch.pot:1026:#: model:ir.ui.view,arch_db:l10n_ch.l10n_ch-isr_account_config_settings
addons/mrp_bom_cost/i18n/product_extended.pot:19:#: model:ir.ui.view,arch_db:product_extended.product_product_ext_form_view2
addons/mrp_bom_cost/i18n/product_extended.pot:20:#: model:ir.ui.view,arch_db:product_extended.product_product_view_form_easy_inherit_extended
addons/mrp_bom_cost/i18n/product_extended.pot:21:#: model:ir.ui.view,arch_db:product_extended.product_product_view_form_normal_inherit_extended
addons/mrp_bom_cost/i18n/product_extended.pot:26:#: model:ir.ui.view,arch_db:product_extended.product_product_ext_form_view2
addons/mrp_bom_cost/i18n/product_extended.pot:27:#: model:ir.ui.view,
@odony
odony / queries.sql
Last active May 12, 2018 10:51
Estimates for FK numbers in 11.0 runbot database (-all)
321069-11-0-703290-all=# SELECT count(*) FROM information_schema.columns WHERE table_schema not in ('information_schema', 'pg_catalog');
count
-------
10027
(1 row)
321069-11-0-703290-all=> select count(*) from information_schema.key_column_usage cons where position_in_unique_constraint is not null;
count
-------
@odony
odony / Analysis.sql
Last active December 9, 2018 21:22
10.0 stock.quant GROUP BY timings for translations
10e=# SELECT (SELECT COUNT(*) FROM product_product), (SELECT COUNT(*) FROM stock_quant), (SELECT COUNT(*) FROM ir_translation);
count | count | count
-------+-------+--------
41072 | 42082 | 409600
(1 row)
10e=# show work_mem;
work_mem
----------
64MB
@odony
odony / keybase.md
Created July 25, 2017 12:33
keybase.md

Keybase proof

I hereby claim:

  • I am odony on github.
  • I am odony (https://keybase.io/odony) on keybase.
  • I have a public key ASDs1AzG7_qAU0OmXyvweogzxe12go53tqZTcxxgrQ7HOAo

To claim this, I am signing this object:

@odony
odony / groups_implied_perf.saas-16.patch
Created May 31, 2017 16:05
Perf patch for group management on databases with many users
diff --git odoo/addons/base/res/res_users.py odoo/addons/base/res/res_users.py
index ae8863e..c3e3a41 100644
--- odoo/addons/base/res/res_users.py
+++ odoo/addons/base/res/res_users.py
@@ -624,8 +624,29 @@ class GroupsImplied(models.Model):
if values.get('users') or values.get('implied_ids'):
# add all implied groups (to all users of each group)
for group in self:
- vals = {'users': zip(repeat(4), group.with_context(active_test=False).users.ids)}
- super(GroupsImplied, group.trans_implied_ids).write(vals)
diff --git a/addons/website/models/website.py b/addons/website/models/website.py
index f630eef..7794ff8 100644
--- a/addons/website/models/website.py
+++ b/addons/website/models/website.py
# Enable request logging in Odoo using one of the following:
# * pass --log-level=debug_rpc
# * or pass --log-handler=odoo.http.rpc.request:DEBUG (to only debug request times)
# * or set the equivalent config option in the Odoo config file
# Then save the following as a munin plugin to monitor the last 5 minutes of your Odoo config file
# Be sure to set the correct path for the Odoo log file, and adjust the variables as needed
#!/bin/bash
# Setup an appropriate nginx log_format in the `http` section of your nginx config:
log_format main '$remote_addr $time_iso8601 "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_host" '
'"$http_user_agent" "$http_x_forwarded_for" '
'$request_time ';
# Then save the following as a munin plugin to monitor the last 5 minutes of your nginx access.log file
# Requires a local Odoo 9 server that is only listening to 127.0.0.1
# interface on port 8069, with website/ecommerce installed, and
# a proper --db-filter setting. --proxy-mode recommended too.
# This is an *untested* sample nginx configuration for demo purpose,
# please double-check all the settings and test the actual security
# of your setup - don't take it for granted.
# It is likely to break some built-in features of Odoo as well,
# might require whitelisting some extra routes.
@odony
odony / odoo_min_avg.sh
Created February 13, 2015 17:13
Sample Munin plugin for min/avg Odoo 8.0 RPC calls
#!/bin/sh
#%# family=manual
#%# capabilities=autoconf suggest
case $1 in
config)
echo graph_category openerp
echo graph_title openerp rpc requests min/average response time
echo graph_vlabel seconds
echo graph_args --units-exponent -3
echo min.label min