From 073724fb1d5abefb58bbd84fe5cd7b22c31891e6 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Fri, 17 Jan 2025 17:53:42 +0100 Subject: [PATCH] fixup! [MIG] hr_timesheet_portal to v14 --- hr_timesheet_portal/static/src/js/hr_timesheet_portal.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hr_timesheet_portal/static/src/js/hr_timesheet_portal.js b/hr_timesheet_portal/static/src/js/hr_timesheet_portal.js index 16c971591..994799582 100644 --- a/hr_timesheet_portal/static/src/js/hr_timesheet_portal.js +++ b/hr_timesheet_portal/static/src/js/hr_timesheet_portal.js @@ -29,7 +29,12 @@ odoo.define("hr_timesheet_portal", function (require) { }).then(this.proxy("_reload_timesheet"), this.proxy("_display_failure")); }, - _onclick_add: function () { + _onclick_add: function (e) { + var $currentTarget = jQuery(e.currentTarget); + if ($currentTarget.prop("disabled") || this.$("input").length) { + return; + } + $currentTarget.prop("disabled", true); var self = this; return this._rpc({ model: "account.analytic.line", @@ -86,6 +91,7 @@ odoo.define("hr_timesheet_portal", function (require) { if (!$existing_tbody.length) { return self.$("thead").after($tbody); } + self.$("h5").prop("disabled", false); return self.$("tbody").replaceWith($tbody); }); }, @@ -104,6 +110,7 @@ odoo.define("hr_timesheet_portal", function (require) { _edit_line(line_id) { var $line = this.$(_.str.sprintf("tr[data-line-id=%s]", line_id)), $edit_line = $line.clone(); + this.$("h5").prop("disabled", true); this.$("tbody tr.edit").remove(); this.$("tbody tr").show(); $line.before($edit_line);