diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-06-26 19:19:39 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-06-26 19:19:39 +0200 |
| commit | 34b432d528f9161e955b05757a898442ff4fbcf8 (patch) | |
| tree | b25015f10fb9a70739de76b886c04b52463f08bb /addons/web/static/src/js/core/pyeval.js | |
| parent | 99ce9e7c607aab99b305b361f3d8e24d9d78c4c2 (diff) | |
| parent | 4d79a1ff58ff6ff3b4fdebc609ce77896c125e3d (diff) | |
[MERGE] forward port branch saas-15 up to 4d79a1ff58f
Diffstat (limited to 'addons/web/static/src/js/core/pyeval.js')
| -rw-r--r-- | addons/web/static/src/js/core/pyeval.js | 16 |
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, { |
