diff options
| author | Nicolas Lempereur <nle@odoo.com> | 2018-09-06 10:29:21 +0200 |
|---|---|---|
| committer | Nicolas Lempereur <nle@odoo.com> | 2018-09-06 13:14:42 +0200 |
| commit | 72f76caa39ff33bbae6f37ee35ae071570b40877 (patch) | |
| tree | 2e2431b4a76296c251ce10cedc7f4cd76acab106 /addons/web/static/src/js | |
| parent | 1d0940d96f3f5de45b38a9ddad9af65087dd04f3 (diff) | |
[FIX] web: relativedelta>11months work as expected
Since march 2015, using in a domain "relativedelta(months=X)" with
X being bigger than 11 or lower than -11 would result in an error.
This is because in the refactoring adding modules (e8a00bc50d) the two
functions divmod and utils.divmod with different implementation in
pyeval.js were replaced by one function divmod in web.utils module.
But there was still an usage of the removed implementation.
opw-1880766
closes #26816
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/framework/pyeval.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/addons/web/static/src/js/framework/pyeval.js b/addons/web/static/src/js/framework/pyeval.js index bcab0b0717f..ea24ac87ecc 100644 --- a/addons/web/static/src/js/framework/pyeval.js +++ b/addons/web/static/src/js/framework/pyeval.js @@ -627,13 +627,15 @@ var relativedelta = py.type('relativedelta', null, { this._fix(); }, _fix: function () { + var self = this; var months = asJS(this.ops.months); if (Math.abs(months) > 11) { var s = months > 0 ? 1 : -1; - var r = utils.divmod(months * s, 12); - this.ops.months = py.float.fromJSON(r.mod*s); - this.ops.years = py.float.fromJSON( - asJS(this.ops.years) + r.div*s); + utils.divmod(months * s, 12, function (years, months) { + self.ops.months = py.float.fromJSON(months*s); + self.ops.years = py.float.fromJSON( + asJS(self.ops.years) + years*s); + }); } this._has_time = 0; }, |
