This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AttrDict(dict): | |
""" Simple class to make dictionary able to use attribute get operation | |
to get elements it contains using syntax like: | |
>>> d = AttrDict(arg1=1, arg2='hello') | |
>>> print d.arg1 | |
1 | |
>>> print d.arg2 | |
hello | |
>>> print d['arg2'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# A simple bash script to share git repositories via standard git daemon application | |
# run: "git_serv start [--listen <address>]" to start git daemon listening on address | |
# run: "git_serv share [repository_name]" inside a repository to share this repository. | |
# run: "git_serv del_share" inside a repository to stop sharing this repository | |
# run: "git_serv stop" to stop serving | |
# | |
# After first to steps your repository will be available to be cloned via command: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from osv import fields | |
class integer_x(fields._column): | |
_type = 'integer' | |
_symbol_c = '%s' | |
_symbol_f = lambda x: x and int(x) or None | |
_symbol_set = (_symbol_c, _symbol_f) | |
_symbol_get = lambda self,x: x #or 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
# | |
# Bash script to instal dev version of OpenERP version 7 in local environment | |
# | |
# Ussage: | |
# bash install.bash [dest-dir] | |
# | |
# installs OpenERP into specified directory. automatically creates base config, | |
# run_server script, and script to create skeletons of new modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# WARNING: This is old and unmaintained version. | |
# for better quality install script look at: https://katyukha.gitlab.io/odoo-helper-scripts/ | |
# | |
# Bash script to instal dev version of OpenERP version 8 in local environment | |
# | |
# Usage: | |
# bash install.bash [dest-dir] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Update all git directories below current directory or specified directory | |
# Skips directories that contain a file called .ignore | |
# | |
# Params: | |
# $1 - directory to search repositories in | |
# all next will be passed to git | |
# | |
# Example: | |
# bash bulk_git.bash ~/projects/ status |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: | |
# new_module.bash <module_name> [root] | |
# Where 'root' arg is root directory to place module in. By default it is 'custom_addons' | |
# | |
# Guess directory script is placed in | |
F=`readlink -f $0` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xml_template = """<?xml version="1.0" encoding="utf-8"?> | |
<openerp> | |
<data> | |
%(views)s | |
</data> | |
</openerp> | |
""" | |
view_template = """ | |
<record id="%(view_id)s_%(view_type)s_view" model="ir.ui.view"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _price_rule_get_multi(self, cr, uid, pricelist, products_by_qty_by_partner, context=None): | |
context = context or {} | |
date = context.get('date') or time.strftime('%Y-%m-%d') | |
products = map(lambda x: x[0], products_by_qty_by_partner) | |
currency_obj = self.pool.get('res.currency') | |
product_obj = self.pool.get('product.template') | |
product_uom_obj = self.pool.get('product.uom') | |
price_type_obj = self.pool.get('product.price.type') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Originaly got from http://www.peterbe.com/plog/uniqifiers-benchmark | |
import re | |
from sets import Set | |
def f1(seq): # Raymond Hettinger | |
# not order preserving | |
set = {} | |
map(set.__setitem__, seq, []) | |
return set.keys() |
OlderNewer