diff options
| author | Mohammed Shekha <msh@odoo.com> | 2019-09-05 10:02:13 +0000 |
|---|---|---|
| committer | Alexandre Kühn <aku@odoo.com> | 2019-11-25 15:09:58 +0000 |
| commit | b7983df87a97765b83d5c012c9f252a501d94d77 (patch) | |
| tree | 865d253dffbc9e83fcf16e2e5a30e46002a41e54 /addons/web/static/src/js | |
| parent | c349e306df8ddf85d63067b6267466c5c23a8dca (diff) | |
[IMP] web: do not pass default_name in calendar create if false
`name` field can be required and falsy `data.name` should not be
added as default in context or it warns for missing required field.
Task-2052536
closes odoo/odoo#35880
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
Diffstat (limited to 'addons/web/static/src/js')
| -rw-r--r-- | addons/web/static/src/js/views/calendar/calendar_controller.js | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/calendar/calendar_controller.js b/addons/web/static/src/js/views/calendar/calendar_controller.js index 37ee9f94fb7..d59ea076188 100644 --- a/addons/web/static/src/js/views/calendar/calendar_controller.js +++ b/addons/web/static/src/js/views/calendar/calendar_controller.js @@ -270,7 +270,11 @@ var CalendarController = AbstractController.extend({ var data = this.model.calendarEventToRecord(event.data); var context = _.extend({}, this.context, event.options && event.options.context); - context.default_name = data.name || null; + // context default has more priority in default_get so if data.name is false then it may + // lead to error/warning while saving record in form view as name field can be required + if (data.name) { + context.default_name = data.name; + } context['default_' + this.mapping.date_start] = data[this.mapping.date_start] || null; if (this.mapping.date_stop) { context['default_' + this.mapping.date_stop] = data[this.mapping.date_stop] || null; |
