From e962f2bb77d1d794c357d1cdacc0dd2c4912b850 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20K=C3=BChn?= Date: Mon, 27 Aug 2018 10:52:53 +0200 Subject: [FIX] mail: add new note without date from activity menu Before this commit, it was not possible to add a note from the activity menu when no datetime has been selected from the datepicker. This is due to the server-side code that requires a deadline date to be set, otherwise no note is created. Even though the placeholder of the datetime tells 'Today', no datetime was provided to the server, thus the problem mentionned above. This commit fixes the issue by ensuring that a deadline date is always provided to the server from the `/note/new` route. In particular, if no datetime has been selected, it still displays 'Today' and sets the current datetime before the RPC. Task-ID 1875668 --- addons/note/static/src/js/systray_activity_menu.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'addons/note/static/src') diff --git a/addons/note/static/src/js/systray_activity_menu.js b/addons/note/static/src/js/systray_activity_menu.js index f65dfce244f..e2e484ca10f 100644 --- a/addons/note/static/src/js/systray_activity_menu.js +++ b/addons/note/static/src/js/systray_activity_menu.js @@ -36,6 +36,8 @@ ActivityMenu.include({ }, /** * Save the note to database using datepicker date and field as note + * By default, when no datetime is set, it uses the current datetime. + * * @private */ _saveNote: function () { @@ -47,6 +49,8 @@ ActivityMenu.include({ var noteDateTime = this.noteDateTimeWidget.getValue(); if (noteDateTime) { params = _.extend(params, {'date_deadline': noteDateTime}); + } else { + params = _.extend(params, {'date_deadline': moment()}); } this.$('.o_note_show').removeClass('d-none'); this.$('.o_note').addClass('d-none'); -- cgit v1.2.3