summaryrefslogtreecommitdiff
path: root/addons/timer/static/src/js/timer_toggle_button.js
diff options
context:
space:
mode:
authorNisha patel <nit@odoo.com>2020-04-07 10:19:29 +0000
committerBarad Mahendra <mba@openerp.com>2020-04-29 13:29:31 +0000
commit6bfc5bd817b37727f7bf42326faf592a8365b303 (patch)
tree40d6dbf88f51c466917b6b2f1b0e2eb05c7a1c94 /addons/timer/static/src/js/timer_toggle_button.js
parentdb957181fe15fab95f3a352c1702ddab9ed2278e (diff)
[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) <yti@odoo.com>
Diffstat (limited to 'addons/timer/static/src/js/timer_toggle_button.js')
-rw-r--r--addons/timer/static/src/js/timer_toggle_button.js3
1 files changed, 3 insertions, 0 deletions
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]
});