From 2db5ee0f7be9f22d87fbffa72c743b3ab92bcd60 Mon Sep 17 00:00:00 2001 From: qsm-odoo Date: Thu, 23 Feb 2017 14:19:56 +0100 Subject: [PATCH] [IMP] web: some more linting to follow guidelines --- addons/web/static/src/js/_deprecated/data.js | 44 +++++++++---------- addons/web/static/src/js/core/context.js | 6 +-- .../static/src/js/views/basic/basic_model.js | 16 +++---- 3 files changed, 32 insertions(+), 34 deletions(-) diff --git a/addons/web/static/src/js/_deprecated/data.js b/addons/web/static/src/js/_deprecated/data.js index 66469ff1374..791693bce67 100644 --- a/addons/web/static/src/js/_deprecated/data.js +++ b/addons/web/static/src/js/_deprecated/data.js @@ -314,7 +314,7 @@ var DataSet = Class.extend(mixins.PropertiesMixin, { * * @param {String} model the OpenERP model this dataset will manage */ - init: function(parent, model, context) { + init: function (parent, model, context) { mixins.PropertiesMixin.init.call(this); this.model = model; this.context = context || {}; @@ -341,7 +341,7 @@ var DataSet = Class.extend(mixins.PropertiesMixin, { } return this; }, - select_id: function(id) { + select_id: function (id) { var idx = this.get_id_index(id); if (idx === null) { return false; @@ -350,7 +350,7 @@ var DataSet = Class.extend(mixins.PropertiesMixin, { return true; } }, - get_id_index: function(id) { + get_id_index: function (id) { for (var i=0, ii=this.ids.length; i string} resolves to the parent id */ - toggleActive: function(recordIDs, value, parentID) { + toggleActive: function (recordIDs, value, parentID) { var self = this; var parent = this.localData[parentID]; - var resIDs = _.map(recordIDs, function(recordID) { + var resIDs = _.map(recordIDs, function (recordID) { return self.localData[recordID].res_id; }); return this @@ -997,6 +996,7 @@ var Model = AbstractModel.extend({ var field = record.fields[name]; if (!field) { return; } // ignore changes of unknown fields + var rec; if (field.type === 'many2one' ) { // in some case, the value returned by the onchange can // be false (no value), so we need to avoid creating a @@ -1008,7 +1008,7 @@ var Model = AbstractModel.extend({ var data = _.isArray(val) ? {id: val[0], display_name: val[1]} : {id: val}; - var rec = self._makeDataPoint({ + rec = self._makeDataPoint({ context: context, data: data, modelName: field.relation, @@ -1019,7 +1019,6 @@ var Model = AbstractModel.extend({ record._changes = record._changes || {}; var listId = record._changes[name] || record.data[name]; var list = self.localData[listId]; - var rec; _.each(val, function (command) { if (command[0] === 0 || command[0] === 1) { // CREATE or UPDATE @@ -2032,7 +2031,6 @@ var Model = AbstractModel.extend({ }, }); -return Model; - +return BasicModel; });