This file contains hidden or 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
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, |
This file contains hidden or 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 -*- | |
import unittest | |
from openerp.myaddon.util import osv_unittest | |
class MyTests(unittest.TestCase): | |
def test_upper(self): | |
self.assertEqual('dn_vn_nsn'.upper(), 'DN_VN_NSN') |
This file contains hidden or 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 version="1.0" encoding="utf-8"?> | |
<openerp> | |
<data> | |
<!-- Disable the spyware - OpenERP 6.1 :-) --> | |
<record id="base.ir_cron_ping_scheduler" model="ir.cron"> | |
<field eval="False" name="active"/> | |
</record> | |
</data> |
This file contains hidden or 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
2081-03-15T23:25:02,2078-03-10T19:31:34 | |
1987-08-20T19:14:03,2029-11-13T01:33:25 | |
2025-03-22T18:42:50,2095-03-28T13:49:00 | |
1934-09-22T20:04:50,1926-05-14T06:41:35 | |
2038-08-18T13:31:05,1948-05-20T22:42:15 | |
1942-05-14T19:02:46,2021-12-29T11:44:41 | |
1909-05-20T03:47:53,2083-10-10T21:48:34 | |
2048-10-20T11:53:20,1984-02-08T09:38:25 | |
2028-05-12T06:39:36,2029-12-25T09:36:52 | |
1907-03-17T09:24:56,1970-03-16T12:36:24 |
This file contains hidden or 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
2013-07-11 08:06:29,372 20378 ERROR ? openerp.addons.web.common.http.HttpRequest.dispatch: An error occurred while handling a json request | |
Traceback (most recent call last): | |
File "/srv/openerp/instances/openerp/src/web/addons/web/common/http.py", line 260, in dispatch | |
r = method(controller, self, **self.params) | |
File "/srv/openerp/instances/openerp/src/web/addons/web/controllers/main.py", line 1876, in index | |
cookies={'fileToken': int(token)}) | |
File "/srv/openerp/instances/openerp/src/web/addons/web/common/http.py", line 307, in make_response | |
response.set_cookie(k, v) | |
File "/srv/openerp/.buildout/eggs/Werkzeug-0.9.1-py2.6.egg/werkzeug/wrappers.py", line 960, in set_cookie | |
self.charset)) |
This file contains hidden or 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
import dateutil.parser | |
from babel.core import Locale | |
class LocalizedParserinfo(dateutil.parser.parserinfo): | |
def __init__(self, locale): | |
locale = Locale.parse(locale) | |
# Build localized list of words, remove dots | |
self.WEEKDAYS = [(locale.days['format']['wide'][i], | |
locale.days['format']['abbreviated'][i].rstrip('.')) |
This file contains hidden or 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 MagicList(list): | |
def __getitem__(self, key): | |
if not isinstance(key, tuple): | |
return list.__getitem__(self, key) | |
rv = [] | |
for element in key: | |
value = list.__getitem__(self, element) | |
if isinstance(element, slice): | |
rv.extend(value) |
This file contains hidden or 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
openerp.web_myaddon = function(openerp) { | |
var hostname = window.location.hostname, | |
params = jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()) | |
if (!openerp.web_myaddon) { | |
/** @namespace */ | |
openerp.web_myaddon = {}; | |
} |
This file contains hidden or 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
/* /web_mycompany/static/src/css/mycompany.css */ | |
/* Header */ | |
.openerp.production .company_logo { | |
background: url('/web_mycompany/static/src/img/logo.png'); | |
/* width:180px; */ | |
/* height:46px; */ | |
} | |
/* ... and similar CSS hacks ... */ |
This file contains hidden or 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
import re | |
# Helper to check if the name is a valid identifier | |
_isidentifier = re.compile(r'[a-zA-Z_]\w*').match | |
@contextlib.contextmanager | |
def savepoint(cr, name, quiet=False): | |
assert _isidentifier(name) | |
cr.execute('SAVEPOINT "%s";' % name) |