summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-03-28 11:50:33 +0200
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit7bb12de1c659546dccd74d36995639206c891338 (patch)
treebad00e19b4fe3d508d586d6e43fc877486a5199e /addons/web/static/src
parent7df1ef5305c993931ef24cfbe38290ad9597e268 (diff)
[REF] web: remove old commented code
Also, add some docstring tags.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/fields/upgrade_fields.js5
-rw-r--r--addons/web/static/src/js/views/abstract_controller.js228
-rw-r--r--addons/web/static/src/js/views/abstract_renderer.js23
-rw-r--r--addons/web/static/src/js/views/calendar/calendar_renderer.js6
-rw-r--r--addons/web/static/src/js/views/calendar/calendar_view.js8
-rw-r--r--addons/web/static/src/js/views/form/form_controller.js90
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_view.js10
7 files changed, 9 insertions, 361 deletions
diff --git a/addons/web/static/src/js/fields/upgrade_fields.js b/addons/web/static/src/js/fields/upgrade_fields.js
index 66d6d2b2903..e24f26cc8cb 100644
--- a/addons/web/static/src/js/fields/upgrade_fields.js
+++ b/addons/web/static/src/js/fields/upgrade_fields.js
@@ -109,6 +109,7 @@ var AbstractFieldUpgrade = {
//--------------------------------------------------------------------------
/**
+ * @private
* @param {MouseEvent}
*/
_onInputClicked: function (event) {
@@ -131,12 +132,14 @@ var UpgradeBoolean = FieldBoolean.extend(AbstractFieldUpgrade, {
/**
* @override
+ * @private
*/
_insertEnterpriseLabel: function ($enterprise_label) {
this.$el.append('&nbsp;').append($enterprise_label);
},
/**
* @override
+ * @private
*/
_resetValue: function () {
this.$input.prop("checked", false).change();
@@ -163,12 +166,14 @@ var UpgradeRadio = FieldRadio.extend(AbstractFieldUpgrade, {
/**
* @override
+ * @private
*/
_insertEnterpriseLabel: function ($enterprise_label) {
this.$('label').last().append('&nbsp;').append($enterprise_label);
},
/**
* @override
+ * @private
*/
_resetValue: function () {
this.$('input').first().prop("checked", true).click();
diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js
index 252b8379565..df44309636b 100644
--- a/addons/web/static/src/js/views/abstract_controller.js
+++ b/addons/web/static/src/js/views/abstract_controller.js
@@ -212,6 +212,7 @@ var AbstractController = Widget.extend({
* something has changed. The main use for this is to update the url, for
* example with a new id.
*
+ * @private
* @param {Object} [state] information that will be pushed to the outside
* world
*/
@@ -226,6 +227,7 @@ var AbstractController = Widget.extend({
* message when no content is available. It is suggested to override
* _update to call this method.
*
+ * @private
* @param {boolean} hasNoContent
*/
_toggleNoContentHelper: function (hasNoContent) {
@@ -251,6 +253,7 @@ var AbstractController = Widget.extend({
* some buttons in the control panel, such as the current graph type for a
* graph view.
*
+ * @private
* @param {Object} state the state given by the model
* @returns {Deferred}
*/
@@ -271,6 +274,7 @@ var AbstractController = Widget.extend({
* to get the res_id. It should receive the res_id in the event data
* @todo move this to basic controller? or view manager
*
+ * @private
* @param {OdooEvent} event
* @param {number} event.data.id The local model ID for the record to be
* opened
@@ -293,227 +297,3 @@ return AbstractController;
});
- // do_show: function () {
- // this._super.apply(this, arguments);
- // core.bus.trigger('view_shown', this);
- // },
- // do_push_state: function (state) {
- // if (this.getParent() && this.getParent().do_push_state) {
- // this.getParent().do_push_state(state);
- // }
- // },
- // do_load_state: function (state, warm) {
- // },
- /**
- * Switches to a specific view type
- */
- // do_switch_view: function () {
- // this.trigger.apply(this, ['switch_mode'].concat(_.toArray(arguments)));
- // },
- // hasNoContent: function (state) {
- // return !state.count && this.no_content_help;
- // },
- // displayNoContentHelp: function () {
- // var $msg = $('<div>')
- // .addClass('oe_view_nocontent')
- // .html(this.no_content_help);
- // this.$el.append($msg);
- // return;
- // },
- // open_record: function (id, options) {
- // // TODO: move this to view manager at some point
- // var state = this.model.get(this.db_id);
- // var record = this.model.get(id);
- // var res_ids;
- // if (state.groupedBy.length) {
- // res_ids = _.pluck(_.flatten(_.pluck(state.data, 'data')), 'res_id');
- // } else {
- // res_ids = _.pluck(state.data, 'res_id');
- // }
- // options = _.extend({}, options, {
- // dataset: {
- // res_ids: res_ids,
- // current_id: record.res_id,
- // },
- // });
- // this.trigger_up('switch_view', {
- // view_type: 'form',
- // options: options,
- // });
- // },
- // open_dialog: function (event) {
- // var data = event.data;
- // data.flags = _.defaults(data.flags || {}, {
- // mode: 'edit',
- // footer_to_buttons: true,
- // action_buttons: false,
- // headless: true
- // });
- // this.do_action({
- // type: 'ir.actions.act_window',
- // res_model: data.model || this.model,
- // res_id: data.id,
- // view_id: data.view_id,
- // view_mode: data.type || 'form',
- // view_type: data.type || 'form',
- // views: [[false, data.type || 'form']],
- // target: 'new',
- // context: data.context,
- // flags: data.flags,
- // }, {
- // on_load: function (action) {
- // action.viewManager.$('.o_form_statusbar').remove();
- // data.on_load && data.on_load(action.viewManager);
- // },
- // });
- // },
- // _onDeletedRecords: function () {
- // this.update_state(this.db_id);
- // },
- // update_state: function (db_id) {
- // this.db_id = db_id;
- // var state = this.model.get(db_id);
- // if (state.type === 'record') {
- // this.set({ title : state.data.id ? state.data.display_name : _t("New") });
- // }
- // if (this.pager && this.config.hasPager) {
- // this.update_pager();
- // }
- // if (this.$buttons) {
- // this.update_buttons();
- // }
- // this.$('.oe_view_nocontent').remove();
- // if (this.hasNoContent(state)) {
- // if (this.renderer) {
- // this.renderer.do_hide();
- // }
- // this.displayNoContentHelp();
- // return;
- // }
- // if (this.renderer) {
- // this.update_renderer();
- // this.renderer.do_show();
- // }
- // var params = state.res_id ? {id: state.res_id} : {};
- // this.do_push_state(params);
- // core.bus.trigger('view_shown');
- // },
- // reload: function (event) {
- // var db_id = event && event.data && event.data.db_id;
- // if (db_id) {
- // // reload the relational field given its db_id
- // this.model.reload(db_id).then(this._confirmSave.bind(this, db_id));
- // } else {
- // // no db_id given, so reload the main record
- // return this.model.reload(this.db_id).then(this.update_state.bind(this));
- // }
- // },
- // update_renderer: function () {
- // var state = this.model.get(this.db_id);
- // return this.renderer.update(state);
- // },
- // renderPager: function ($node, options) {
- // var data = this.model.get(this.db_id, {raw: true});
- // this.pager = new Pager(this, data.count, data.offset + 1, this.page_size, options);
-
- // this.pager.on('pager_changed', this, function (new_state) {
- // var self = this;
- // var data = this.model.get(this.db_id);
- // this.pager.disable();
- // var limit_changed = (this.page_size !== new_state.limit);
- // this.page_size = new_state.limit;
- // this.model
- // .setLimit(data.id, new_state.limit)
- // .setOffset(data.id, new_state.current_min - 1)
- // .reload(data.id)
- // .then(function (state) {
- // self.update_state(state);
- // // Reset the scroll position to the top on page changed only
- // if (!limit_changed) {
- // self.trigger_up('scrollTo', {offset: 0});
- // }
- // })
- // .then(this.pager.enable.bind(this.pager));
- // });
- // this.pager.appendTo($node = $node || this.options.$pager);
- // this.update_pager(); // to force proper visibility
- // },
- // update_buttons: function () {
- // },
- // update_pager: function () {
- // var data = this.model.get(this.db_id);
- // this.pager.updateState({
- // current_min: data.offset + 1,
- // size: data.count,
- // });
- // var is_pager_visible = (data.type === 'record') || (!!data.count && (data.groupedBy && !data.groupedBy.length));
- // this.pager.do_toggle(is_pager_visible);
- // },
- // do_search: function (domain, context, group_by) {
- // var load = this.db_id ? this._reload_data : this._load_data;
- // return load.call(this, domain, context, group_by).then(this.update_state.bind(this));
- // },
- // _load_data: function (domain, context, group_by) {
- // return this.model
- // .load({
- // type: 'record',
- // model: this.modelName,
- // domain: domain,
- // groupedBy: group_by,
- // context: context,
- // });
- // },
- // _reload_data: function (domain, context, group_by) {
- // return this.model
- // .setDomain(this.db_id, domain)
- // .setContext(this.db_id, context)
- // .setGroupBy(this.db_id, group_by)
- // .reload(this.db_id);
- // },
- // sidebar_eval_context: function () {
- // return $.when({});
- // },
- // /**
- // * Return whether the user can perform a given action (e.g. 'create', 'edit') in this view.
- // * An action is disabled by setting the corresponding attribute in the view's main element,
- // * like: <form string="" create="false" edit="false" delete="false">
- // */
- // is_action_enabled: function (action) {
- // var attrs = this.fields_view.arch.attrs;
- // return (action in attrs) ? JSON.parse(attrs[action]) : true;
- // },
- // config: {
- // openGroupByDefault: false,
- // page_size: 40,
- // hasPager: true, // TODO: change this into false
- // js_libs: [], // the list of lazy-loaded js dependencies
- // css_libs: [], // the list of lazy-loaded css dependencies
- // },
- // defaults: {
- // action: {},
- // },
- // used by views that need a searchview.
- // searchable: true,
- // used by views that need a searchview but don't want it to be displayed.
- // searchview_hidden: false,
-
- // events: {
- // 'click a[type=action]': function (ev) {
- // ev.preventDefault();
- // var action_data = $(ev.target).attr('name');
- // this.do_action(action_data);
- // }
- // },
-
- // custom_events: _.extend({}, FieldManagerMixin.custom_events, {
- // open_record: function (event) {
- // this.open_record(event.data.id);
- // },
- // reload: 'reload',
- // open_dialog: 'open_dialog',
- // close_dialog: function () {
- // this.do_action({type: 'ir.actions.act_window_close'});
- // },
- // // TODO: add open_action, ...
- // }),
-
diff --git a/addons/web/static/src/js/views/abstract_renderer.js b/addons/web/static/src/js/views/abstract_renderer.js
index c47f6f7e3f3..83aafdfe310 100644
--- a/addons/web/static/src/js/views/abstract_renderer.js
+++ b/addons/web/static/src/js/views/abstract_renderer.js
@@ -94,26 +94,3 @@ return Widget.extend({
});
- // // this method is used to get local state unknown by renderer parent, but
- // // necessary to restore the renderer to a full state after an update. For
- // // example, the currently opened tabs in a form view, or the current scrolling
- // // position
- // getLocalState: function () {
- // // to be implemented by actual renderer
- // },
- // // this method is used after an update (and may also be used after a new renderer
- // // is instantiated). For example, opening a new record in a form view is
- // // done by instantiating a new renderer. But the curently opened page should
- // // be maintained if possible.
- // setLocalState: function (local_state) {
- // // to be implemented by actual renderer
- // },
-
- // var local_state = this.getLocalState();
- // .then(this.setLocalState.bind(this, local_state));
- // // todo: add and use getWidget method
- // getWidget: function (node) {
- // // read field type from node
- // // or get widget name from attrs
- // },
- // },
diff --git a/addons/web/static/src/js/views/calendar/calendar_renderer.js b/addons/web/static/src/js/views/calendar/calendar_renderer.js
index 7a38a0d4348..9d9b09665c4 100644
--- a/addons/web/static/src/js/views/calendar/calendar_renderer.js
+++ b/addons/web/static/src/js/views/calendar/calendar_renderer.js
@@ -445,9 +445,3 @@ return AbstractRenderer.extend({
});
});
-
- // dead code ?
- //
- // calendarMiniChanged: function (datum, obj) {
- // this.$calendar.fullCalendar('gotoDate', +obj.currentYear , +obj.currentMonth, +obj.currentDay);
- // },
diff --git a/addons/web/static/src/js/views/calendar/calendar_view.js b/addons/web/static/src/js/views/calendar/calendar_view.js
index 3bd8099484b..c5df8b7f8f7 100644
--- a/addons/web/static/src/js/views/calendar/calendar_view.js
+++ b/addons/web/static/src/js/views/calendar/calendar_view.js
@@ -133,14 +133,6 @@ var CalendarView = AbstractView.extend({
this.loadParams.scale_zoom = attrs.scale_zoom;
this.loadParams.initialDate = params.initialDate || new Date();
- // is_action_enabled: function (action) {
- // if (action === 'create' && !this.options.creatable) {
- // return false;
- // }
- // return this._super(action);
- // },
-
-
},
});
diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js
index 052072327b2..8c429d00fa2 100644
--- a/addons/web/static/src/js/views/form/form_controller.js
+++ b/addons/web/static/src/js/views/form/form_controller.js
@@ -592,93 +592,3 @@ return FormController;
});
- // load_record: function (id) {
- // var index = _.indexOf(this.datasetIds, this.currentId);
- // return this.model.load({
- // // context: this.options.context,
- // id: id,
- // model: this.modelName,
- // offset: index,
- // res_ids: this.datasetIds,
- // count: this.datasetIds.length,
- // });
- // },
- // do_show: function (view_options) {
- // var defs = [];
- // defs.push(this._super.apply(this, arguments));
- // if (this.has_been_started) {
- // var dataset = view_options && view_options.dataset;
- // this.dataset_ids = dataset ? dataset.res_ids : this.dataset.ids;
- // this.current_id = dataset ? dataset.current_id : this.dataset.ids[this.dataset.index];
- // defs.push(this.load_record(this.current_id).then(this.update_state.bind(this)));
- // }
- // this.has_been_started = true;
- // return $.when.apply($, defs);
- // },
- // _onDeletedRecords: function (ids) {
- // var index = this.dataset_ids.indexOf(this.current_id);
- // this.dataset_ids.splice(index, 1);
- // this.current_id = this.dataset_ids[index];
- // if (!this.current_id) {
- // this.current_id = this.dataset_ids[this.dataset_ids.length - 1];
- // }
- // if (!this.current_id) {
- // this.do_action('history_back');
- // } else {
- // this.load_record(this.current_id).then(this.update_state.bind(this));
- // }
- // },
- // _callButtonAction: function (attrs, record) {
- // var self = this;
- // var def = $.Deferred();
- // record = record || this.model.get(this.db_id);
- // var record_id = record.data.id;
- // this.trigger_up('execute_action', {
- // action_data: _.extend({}, attrs, { context: _.extend(record.getContext(), attrs.context) }),
- // dataset: this.dataset,
- // record_id: record_id,
- // on_close: function (reason) {
- // if (!_.isObject(reason)) {
- // return self.load_record(record_id).then(self.update_state.bind(self));
- // }
- // },
- // on_fail: function () {
- // self.load_record(record_id).then(function (db_id) {
- // self.update_state(db_id);
- // def.resolve();
- // });
- // },
- // on_success: def.resolve.bind(def),
- // });
- // return def;
- // },
- // show_wow: function () {
- // var others = ['o_wow_peace', 'o_wow_heart'];
- // var wow_class = Math.random() <= 0.9 ? 'o_wow_thumbs' : _.sample(others);
- // var $body = $('body');
- // $body.addClass(wow_class);
- // setTimeout(function () {
- // $body.removeClass(wow_class);
- // }, 1000);
- // },
- // _onFieldChanged: function (event) {
- // if (this.mode === 'readonly') {
- // event.data.force_save = true;
- // }
- // this._super.apply(this, arguments);
- // },
- // update_renderer: function () {
- // var state = this.model.get(this.db_id);
- // this.renderer.update(state, {mode: this.mode});
- // },
- // do_action: function (event) {
- // this.do_action(event.data.action, event.data.options || {}).then(function (result) {
- // if (event.data.on_success) {
- // event.data.on_success(result);
- // }
- // });
- // },
-
- // this.dataset_ids = this.options.dataset ? this.options.dataset.res_ids : this.dataset.ids;
- // this.current_id = this.options.dataset ? this.options.dataset.current_id : this.dataset.ids[this.dataset.index];
- // this.options.context = _.extend({}, this.options.action.context, this.options.context);
diff --git a/addons/web/static/src/js/views/kanban/kanban_view.js b/addons/web/static/src/js/views/kanban/kanban_view.js
index 9c8c03dfb27..0cfa6d24a20 100644
--- a/addons/web/static/src/js/views/kanban/kanban_view.js
+++ b/addons/web/static/src/js/views/kanban/kanban_view.js
@@ -70,13 +70,3 @@ return KanbanView;
});
- // config: _.extend({}, AbstractView.prototype.config, {
- // openGroupByDefault: true,
- // }),
- // FIXME: adapt those options
- // defaults: _.extend(BasicController.prototype.defaults, {
- // quick_creatable: true,
- // creatable: true,
- // read_only_mode: false,
- // confirm_on_delete: true,
- // }),