summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core/pyeval.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-06-27 14:19:31 +0200
committerChristophe Simonis <chs@odoo.com>2017-06-27 14:19:31 +0200
commitdd43071638773dcb58376b79ec7b1456c8b0454d (patch)
treefd7935e2aa93de03fa3fe12507f8ef74405a255e /addons/web/static/src/js/core/pyeval.js
parent6501184e6294ffb06e24a0ec8e9666b79a80b59a (diff)
parent278e478d55209bd958836fde7fe1c82c555180dc (diff)
[MERGE] forward port branch saas-16 up to 278e478d552
Diffstat (limited to 'addons/web/static/src/js/core/pyeval.js')
-rw-r--r--addons/web/static/src/js/core/pyeval.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/web/static/src/js/core/pyeval.js b/addons/web/static/src/js/core/pyeval.js
index 75efc9e813f..502c6a4ce90 100644
--- a/addons/web/static/src/js/core/pyeval.js
+++ b/addons/web/static/src/js/core/pyeval.js
@@ -435,6 +435,22 @@ datetime.datetime = py.type('datetime', null, {
this.second,
this.microsecond / 1000);
},
+ __add__: function (other) {
+ if (!py.PY_isInstance(other, datetime.timedelta)) {
+ return py.NotImplemented;
+ }
+ var s = tmxxx(this.year, this.month, this.day + other.days, this.hour, this.minute, this.second + other.seconds);
+ return datetime.datetime.fromJSON(s.year, s.month, s.day, s.hour, s.minute, s.second);
+ },
+ __sub__: function (other) {
+ if (py.PY_isInstance(other, datetime.timedelta)) {
+ return py.PY_add(this, py.PY_negative(other));
+ }
+ return py.NotImplemented;
+ },
+ fromJSON: function (year, month, day, hour, minute, second) {
+ return py.PY_call(datetime.datetime, [year, month, day, hour, minute, second]);
+ },
});
datetime.date = py.type('date', null, {