[FIX] pyeval: argspec of relativedelta
bzr revid: xmo@openerp.com-20130318105244-qkgvi69do0219lkk
This commit is contained in:
@@ -502,12 +502,15 @@ openerp.web.pyeval = function (instance) {
|
||||
return py.PY_call(py.PY_getAttr(d, 'strftime'), [args.format]);
|
||||
});
|
||||
|
||||
var args = _.map(('year month day hour minute second microsecond '
|
||||
+ 'years months weeks days hours minutes secondes microseconds '
|
||||
+ 'weekday leakdays yearday nlyearday').split(' '), function (arg) {
|
||||
return [arg, null]
|
||||
});
|
||||
args.unshift('*');
|
||||
var relativedelta = py.type('relativedelta', null, {
|
||||
__init__: function () {
|
||||
this.ops = py.PY_parseArgs(arguments,
|
||||
'* year month day hour minute second microsecond '
|
||||
+ 'years months weeks days hours minutes secondes microseconds '
|
||||
+ 'weekday leakdays yearday nlyearday');
|
||||
this.ops = py.PY_parseArgs(arguments, args);
|
||||
},
|
||||
__add__: function (other) {
|
||||
if (!py.PY_isInstance(other, datetime.date)) {
|
||||
|
||||
@@ -259,6 +259,12 @@ openerp.testing.section('eval.types', {
|
||||
py.eval('a + a', ctx);
|
||||
}, /^Error: TypeError:/);
|
||||
});
|
||||
test('relastivedelta', function (instance) {
|
||||
strictEqual(
|
||||
py.eval("(datetime.date(2012, 2, 15) + relativedelta(days=-1)).strftime('%Y-%m-%d 23:59:59')",
|
||||
instance.web.pyeval.context()),
|
||||
"2012-02-14 23:59:59");
|
||||
})
|
||||
});
|
||||
openerp.testing.section('eval.edc', {
|
||||
dependencies: ['web.data'],
|
||||
|
||||
Reference in New Issue
Block a user