Skip to content

Instantly share code, notes, and snippets.

Olivier Dony odony

Block or report user

Report or block odony

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
odony /
Last active Aug 27, 2019
multi-company check
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import fields, models, api, _
from odoo.exceptions import UserError
class StockPutawayRule(models.Model):
_name = 'stock.putaway.rule'
_order = 'sequence,product_id'
_description = 'Putaway Rule'
odony / decimal_precision.patch
Last active Jun 19, 2019
Decimal Precision compatibility patch
View decimal_precision.patch
diff --git odoo/addons/base/models/ odoo/addons/base/models/
index c1d00611d43..1bd34a804ce 100644
--- odoo/addons/base/models/
+++ odoo/addons/base/models/
@@ -2,8 +2,10 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, tools
+import odoo.addons
odony / 1912199.patch
Created Feb 15, 2019
patch signature activity task 1912199
View 1912199.patch
diff --git sign/controllers/ sign/controllers/
index c535bff..217e888 100644
--- sign/controllers/
+++ sign/controllers/
@@ -258,8 +258,10 @@ class Sign(http.Controller):
return False
# mark signature as done in next activity
- user_id = http.request.env['res.users'].search([('partner_id', '=',]).id
- request_item.sign_request_id.activity_feedback(['mail.mail_activity_data_todo'], user_id=user_id)
odony /
Last active Jan 15, 2019
Python 3 JSON serialization of floats with chosen precision
import json
import decimal
import odoo
from import float_utils
from decimal import Decimal
# Version 0: BROKEN because float_round does not return the float with the shortest
# representation, so it will serialize as 211.70000000000002.
d = {'foo': float_utils.float_round(211.7, 1)}
odony / Community.txt
Last active Sep 27, 2018
Outdated POT files
View Community.txt
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 / queries.sql
Last active May 12, 2018
Estimates for FK numbers in 11.0 runbot database (-all)
View queries.sql
321069-11-0-703290-all=# SELECT count(*) FROM information_schema.columns WHERE table_schema not in ('information_schema', 'pg_catalog');
(1 row)
321069-11-0-703290-all=> select count(*) from information_schema.key_column_usage cons where position_in_unique_constraint is not null;
odony / Analysis.sql
Last active Dec 9, 2018
10.0 stock.quant GROUP BY timings for translations
View Analysis.sql
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;

Keybase proof

I hereby claim:

  • I am odony on github.
  • I am odony ( on keybase.
  • I have a public key ASDs1AzG7_qAU0OmXyvweogzxe12go53tqZTcxxgrQ7HOAo

To claim this, I am signing this object:

odony / groups_implied_perf.saas-16.patch
Created May 31, 2017
Perf patch for group management on databases with many users
View groups_implied_perf.saas-16.patch
diff --git odoo/addons/base/res/ odoo/addons/base/res/
index ae8863e..c3e3a41 100644
--- odoo/addons/base/res/
+++ odoo/addons/base/res/
@@ -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)
View sitemap generation multi-domains
diff --git a/addons/website/models/ b/addons/website/models/
index f630eef..7794ff8 100644
--- a/addons/website/models/
+++ b/addons/website/models/
You can’t perform that action at this time.