Skip to content

Instantly share code, notes, and snippets.

View bealdav's full-sized avatar

David Beal bealdav

  • Akretion
  • Lyon
View GitHub Profile
@metafloor
metafloor / zpl-quick-reference.md
Last active April 19, 2024 17:24
ZPL Quick Reference

ZPL Commands

Command Format Description
^A ^Afo,h,w,d:f.x Use Scalable/Bitmapped Font
^A@ ^A@o,h,w,d:f.x Use Font Name to Call Font
^B0 ^B0a,b,c,d,e,f,g Aztec Bar Code Parameters
^B1 ^B1o,e,h,f,g Code 11 Bar Code
^B2 ^B2o,h,f,g,e,j Interleaved 2 of 5 Bar Code
^B3 ^B3o,e,h,f,g Code 39 Bar Code
@yelizariev
yelizariev / new-api.sh
Last active March 17, 2017 05:37
Helpers for migrating to new odoo api (10.0+). Obsolete. Check for latest version here: https://odoo-development.readthedocs.io/en/latest/migration/index.html
# IMPORTS
# 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'
@bwrsandman
bwrsandman / to_dev_logo.py
Created January 14, 2015 17:21
to_dev logo stamping for odoo
"""Using PIL add 'DEV' to the company (and the main odoo) logo
This is meant to be run as a script in the upgrade.py script of anybox.recipe.odoo
"""
from base64 import b64encode, b64decode
from cStringIO import StringIO
from PIL import Image, ImageDraw
main_partner = session.registry('ir.model.data').get_object(
session.cr, session.uid, 'base', 'main_partner')
if main_partner.image:
@dreispt
dreispt / odoo-sh.py
Created November 19, 2014 11:04
Odoo Shell: run Odoo commands without a server RPC connection
"""
Setup:
Assuming Odoo 8.0 sources at ~/odoo:
$ cp odoo-sh.py ~/odoo
$ cd ~/odoo
$ python -i odoo-sh.py
Usage example:
>>> env = connect('my-db-name')
>>> Users = env['res.users']
@florentx
florentx / pgutil.py
Created April 16, 2014 13:28
OpenERP - create missing indexes on Foreign Keys
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import contextlib
__all__ = ['savepoint', 'create_missing_indexes']
@contextlib.contextmanager
def savepoint(cr, name, quiet=False):
@guewen
guewen / pg_on_ram.sh
Last active January 24, 2020 08:37
Create a PostgreSQL cluster in a ramfs and start the server on this cluster.
#!/bin/bash
PORT=6432
# Create a ramfs
if [ -f /tmp/pg_on_ram ]
then
echo "/tmp/pg_on_ram already exists"
exit 1
fi
@dreispt
dreispt / openerp-apps.sh
Last active December 29, 2015 16:39
Proof of concept for OpenERP installation using virtualenv and pip
# Create a virtualenv; use system packages to make this faster
virtualenv --system-site-packages myopenerp
cd myopenerp
source bin/activate
# As an example, install OpenERP with the CRM App
pip install --extra-index-url https://googledrive.com/host/0Bz7bXY1bYyqJa2xUSmFVOUVySHc/simple openerp-crm
# Show installed server version
openerp-server --version
import logging
import sys
import colorama
from colorama import Fore, Back, Style
LEVEL_COLOR_MAPPING = {
logging.DEBUG: Fore.BLUE + Back.RESET,
logging.INFO: Fore.GREEN + Back.RESET,
logging.WARNING: Fore.YELLOW + Back.RESET,
@matrixise
matrixise / backup_db.sh
Created September 25, 2012 19:20
Backup all the OpenERP databases and the associated filestores
#!/usr/bin/env bash
ROOT_BACKUP_PATH=/tmp/backup
echo "backup path: ${ROOT_BACKUP_PATH}"
# Create the backup directory
[ -d "$ROOT_BACKUP_PATH" ] || mkdir -p $ROOT_BACKUP_PATH
DATABASES=`psql -ltA -d postgres -c "SELECT datname FROM pg_database WHERE datname NOT IN ('postgres', 'template0', 'template1')"`