summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorfka-odoo <fka@openerp.com>2017-04-12 19:13:02 +0530
committerJeremy Kersten <jke@odoo.com>2017-06-20 10:00:12 +0200
commit30783c7a4359aebc6d5c2e9f9b3f3287d11c2001 (patch)
treea9145835f05b91eb80f63cb6f278f7993b76400d /addons/web/static/src/js
parenteb673297c3dfb39a36b3b15abdd1f28ffc04b49c (diff)
[IMP] web: Time(hours,minutes,seconds) should be calculate using timedelta with datetime on web client, added test cases for pyeval datetime.timedelta
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/framework/pyeval.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/addons/web/static/src/js/framework/pyeval.js b/addons/web/static/src/js/framework/pyeval.js
index bcab0b0717f..c1b823ed48f 100644
--- a/addons/web/static/src/js/framework/pyeval.js
+++ b/addons/web/static/src/js/framework/pyeval.js
@@ -436,6 +436,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, {