From bce3defc8cd2c0c40e40d7b6cfc58159000ded65 Mon Sep 17 00:00:00 2001 From: David Monjoie Date: Mon, 3 Jul 2017 10:46:10 +0200 Subject: [FIX] web: fix calendar server values parsing The record data given to fullCalendar to use in the renderEvent function was not parsed like it is in basic model for example. As a result, date(time) fields were string rather than moment objects, which was triggering the crash that started this commit. --- .../web/static/src/js/views/basic/basic_model.js | 25 ---------------------- 1 file changed, 25 deletions(-) (limited to 'addons/web/static/src/js/views/basic') diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/js/views/basic/basic_model.js index c95f829af71..eead1b0aaed 100644 --- a/addons/web/static/src/js/views/basic/basic_model.js +++ b/addons/web/static/src/js/views/basic/basic_model.js @@ -87,7 +87,6 @@ var concurrency = require('web.concurrency'); var Context = require('web.Context'); var core = require('web.core'); var Domain = require('web.Domain'); -var fieldUtils = require('web.field_utils'); var session = require('web.session'); var _t = core._t; @@ -2946,30 +2945,6 @@ var BasicModel = AbstractModel.extend({ } }); }, - /** - * Processes date(time) and selection field values sent by the server. - * Converts data(time) values to moment instances. - * Converts false values of selection fields to 0 if 0 is a valid key, - * because the server doesn't make a distinction between false and 0, and - * always sends false when value is 0. - * - * @param {Object} field the field description - * @param {*} value - * @returns {*} the processed value - */ - _parseServerValue: function (field, value) { - if (field.type === 'date' || field.type === 'datetime') { - // process date(time): convert into a moment instance - value = fieldUtils.parse[field.type](value, field, {isUTC: true}); - } else if (field.type === 'selection' && value === false) { - // process selection: convert false to 0, if 0 is a valid key - var hasKey0 = _.find(field.selection, function (option) { - return option[0] === 0; - }); - value = hasKey0 ? 0 : value; - } - return value; - }, /** * This method is quite important: it is supposed to perform the /onchange * rpc and apply the result. -- cgit v1.2.3