Skip to content

Instantly share code, notes, and snippets.

@dreispt
dreispt / pdb_example.py
Created December 7, 2011 14:04
Python example of pdb usage
"""
PDB example.
At (pdb) prompt use:
(n)ext +repeat ENTER,
(p)rint var
(l)ist program,
(c)ontinue
(q)quit,
(s)tep into subroutines, use instead of "n"
@dreispt
dreispt / xoe-install.sh
Created July 29, 2012 23:01
Install OpenERP with XOE
#!/bin/bash
unix_user="erp_user"
erp_name="openerp"
#erp_version="6.1"
#service_code="http://download.sisalp.net/openerp-$erp_version.tar.gz"
service_code="http://nightly.openerp.com/trunk/nightly/src/openerp-6.2dev-latest.tar.gz"
programme="server/openerp-server"
service_name="trunk"
@dreispt
dreispt / xoe_script.sh
Created September 18, 2012 22:14
xoe install OpenERp 7
#!/bin/bash
#customize the service name an ports
service_name="trunk"
xml_rpc_port="8081"
xml_rpc_secure_port="8082"
net_rpc_port="8083"
service_code="http://nightly.openerp.com/trunk/nightly/src/openerp-6.2dev-latest.tar.gz"
unix_user="erp_user"
@dreispt
dreispt / install-openerp.sh
Created January 10, 2013 00:04
OpenERP install script
#--------------------------------------------
#install PostgreSQL
yes | sudo apt-get install postgresql
#install Python dependencies
yes | sudo apt-get install python-dateutil python-docutils python-feedparser \
python-gdata python-jinja2 python-ldap python-libxslt1 python-lxml python-mako \
python-mock python-openid python-psycopg2 python-psutil python-pybabel \
python-pychart python-pydot python-pyparsing python-reportlab python-simplejson \
python-tz python-unittest2 python-vatnumber python-vobject python-webdav \
@dreispt
dreispt / oe-admin.sh
Last active May 6, 2018 22:08
A script for one-line installation of OpenERP 7.0 server instances.
#!/bin/bash
################################################################################
# A one-line installation for OpenERP 7.0 server instances
#-------------------------------------------------------------------------------
# USAGE:
#
# * Setup openerp server and create a first OpenERP7 7 instance
# oe-admin install [name1] --full
#
# * Create an additional OpenERP7 7 instance
@dreispt
dreispt / oetor0.4-ui.md
Last active December 17, 2015 10:58
Working on the directory structure and UI design for OpenERP-inator's next version ...

OpenERP-inator's directory structure:

                           ## `oetor init`
/opt/openerp               # HOME directory
  |- oetor                 # oetor script (symlinked to ./src/oetor/oetor)
  |- /src                  # shared SOURCE REPOSITORY
  |    |- /oetor             # oetor script source (cloned form GitHub)
  |    |- /nightly-7.0       # a SOURCE DIR (from nightly builds)
  |    |    |- /server
  |    |                     ## `oetor setup sources 7.0`
@dreispt
dreispt / openerp-modules
Last active December 27, 2015 10:29
OpenERP modules out there
https://github.com/trobz/openerp-booking-chart
https://github.com/trobz/openerp-web-unleashed
@dreispt
dreispt / working_hours.py
Last active December 28, 2015 23:39
How many working hours from friday 16:30 to monday 15:30?
from datetime import time, datetime, timedelta
def working_hours(dt_start, dt_end, work_periods, work_days=range(5)):
dur = (dt_end.date() - dt_start.date()).days + 1
days = (dt_start.date() + timedelta(x) for x in range(dur))
return sum(
[(min(max(datetime.combine(d, h[1]), dt_start), dt_end) -
min(max(datetime.combine(d, h[0]), dt_start), dt_end)
).total_seconds()/3600
@dreispt
dreispt / safe_getattr.py
Last active December 29, 2015 10:29
safe_getattr(): Follow an object attribute dot-notation chain to find the leaf value. If any attribute doesn't exist or has no value, just return False.
def safe_getattr(obj, attr_dot_chain, default=False):
"""
Follow an object attribute dot-notation chain to find the leaf value.
If any attribute doesn't exist or has no value, just return False.
"""
attrs = attr_dot_chain.split('.')
while attrs:
try:
obj = getattr(obj, attrs.pop(0))
except AttributeError:
@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