This is a bug in OpenERP probably since 6.1. This patch (against 7.0) fixes it.
For the curious, the heart of the fix is a few lines to the .../openerp/osv/fields.py
module:
UTC = pytz.timezone('UTC')
.
.
.
class datetime(_column):
...
_symbol_c = '%s'
def _symbol_f(symb):
if symb is None or symb == False:
return None
elif isinstance(symb, unicode):
symb = symb.encode('utf-8')
if not isinstance(symb, str):
# had better be something that quacks like a datetime
if symb.tzinfo is not None:
symb = symb.astimezone(UTC)
symb = symb.strftime(tools.DEFAULT_SERVER_DATETIME_FORMAT)
return symb
_symbol_set = (_symbol_c, _symbol_f)
...
class function(_column):
...
if type == 'datetime':
self._symbol_c = datetime._symbol_c
self._symbol_f = datetime._symbol_f
self._symbol_set = datetime._symbol_set
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…