From fd3febe21be88d66e76f1a6b35278e29ff176989 Mon Sep 17 00:00:00 2001 From: benjamin <benjamin@le-filament.com> Date: Mon, 22 Aug 2022 16:04:32 +0200 Subject: [PATCH] [fix] error JS action view theoretical time --- models/ur_month_timesheet.py | 2 +- static/src/js/ur_month_timesheet.js | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/models/ur_month_timesheet.py b/models/ur_month_timesheet.py index 2a0c223..2d4d813 100644 --- a/models/ur_month_timesheet.py +++ b/models/ur_month_timesheet.py @@ -83,7 +83,7 @@ class ScopMonthTimesheet(models.Model): lambda x: { "year": x.year, "num_month": x.month, - "month": self._fields["month"].selection[x.month - 1][1], + "month": self._fields["month"].selection[int(x.month) - 1][1], } ), "values": month_values.mapped("working_time"), diff --git a/static/src/js/ur_month_timesheet.js b/static/src/js/ur_month_timesheet.js index 10b2b70..dd53939 100644 --- a/static/src/js/ur_month_timesheet.js +++ b/static/src/js/ur_month_timesheet.js @@ -11,18 +11,17 @@ odoo.define("cgscop_timesheet.ur_month_timesheet", function (require) { template: "ScopMonthTimesheet", willStart: function () { - var deferred = new jQuery.Deferred(); + var superDef = this._super.apply(this, arguments); var self = this; this.values = {}; - this._rpc({ + var def = this._rpc({ model: "ur.month.timesheet", method: "get_month_values", args: [], }).then(function (results) { self.values = results; - deferred.resolve(); }); - return jQuery.when(this._super.apply(this, arguments), deferred); + return Promise.all([superDef, def]); }, // Start: function () {}, -- GitLab