Skip to content

Instantly share code, notes, and snippets.

View simahawk's full-sized avatar

Simone Orsi simahawk

View GitHub Profile
@jaroel
jaroel / gist:5345403
Created April 9, 2013 12:42
Parameterised dynamic vocabulary. Shows unique values for catalog index. Pass in the index name in the schema.
Definition:
===========
from zope.schema.interfaces import IContextSourceBinder, IBaseVocabulary
class CatalogIndexValuesSource(object):
grok.implements(IContextSourceBinder, IBaseVocabulary)
def __init__(self, index_name):
self.index_name = index_name
@grindtildeath
grindtildeath / odoo_module_dependency_graph.sql
Last active August 18, 2022 14:21
Odoo module dependency graph
WITH recursive dep_tree AS (
SELECT mdl0.id, mdl0.name, NULL::integer, 1 AS level, array[mdl0.id] AS path_info
FROM ir_module_module mdl0
WHERE name = 'sale' -- state here the child module
UNION ALL
SELECT (SELECT mdl1.id FROM ir_module_module mdl1 WHERE mdl1.name = c.name), rpad('', p.level * 1, '_') || c.name, c.module_id, p.level + 1, p.path_info||c.id
FROM ir_module_module_dependency c
JOIN dep_tree p ON c.module_id = p.id
WHERE level < 5 -- define here the levels to be displayed
)
@sbidoul
sbidoul / port-pr.py
Last active June 29, 2024 03:12
Port a PR to another branch
#!/usr/bin/python3
import json
import argparse
import os
import re
import shlex
import shutil
import subprocess
import tempfile
import textwrap