From 6bfc5bd817b37727f7bf42326faf592a8365b303 Mon Sep 17 00:00:00 2001 From: Nisha patel Date: Tue, 7 Apr 2020 10:19:29 +0000 Subject: [FIX] hr_timesheet, timer: Fix traceback in kanban view when using the timer Currently, when the unit amount of line is zero and the timer time spent on entry is less than one minutes then entries are unlinked once the timer is stopped and due to that the entry disappear from the kanban view and traceback is generated. After this commit, we fix the issue by preventing the deletion of entries by setting options 'prevent_deletion' on widget so we should no allow to delete the entry if the option is set on widget. closes odoo/odoo#50395 Taskid: 2230155 Closes: #49128 X-original-commit: 64b9a9b4deaee5a8139b0afbe3f222a476a038f9 Signed-off-by: Yannick Tivisse (yti) --- addons/timer/static/src/js/timer_toggle_button.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/timer/static/src/js/timer_toggle_button.js') diff --git a/addons/timer/static/src/js/timer_toggle_button.js b/addons/timer/static/src/js/timer_toggle_button.js index 544c6219940..1bb5c2185d7 100644 --- a/addons/timer/static/src/js/timer_toggle_button.js +++ b/addons/timer/static/src/js/timer_toggle_button.js @@ -50,10 +50,13 @@ const TimerToggleButton = FieldToggleBoolean.extend({ * @param {MouseEvent} event */ _onToggleButton: async function (event) { + const context = this.record.getContext(); + const prevent_deletion = this.attrs.options && this.attrs.options.prevent_deletion || false; event.stopPropagation(); const result = await this._rpc({ model: this.model, method: this._getActionButton(), + context: $.extend({}, context, {prevent_deletion: prevent_deletion}), args: [this.res_id] }); -- cgit v1.2.3