summaryrefslogtreecommitdiff
path: root/addons/google_spreadsheet/static
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2014-10-14 14:48:31 +0200
committerGéry Debongnie <ged@odoo.com>2014-10-21 09:33:52 +0200
commitd82ca918cd0f131959615150bba1930cb9c83fe5 (patch)
tree238dd5b8ec00bf6e1fe520c0cdfca35e93ae6f91 /addons/google_spreadsheet/static
parentef636ed520852357241862b9e6ece7bb32c9e676 (diff)
[IMP] various code improvements
mostly styling, and related micro-changes
Diffstat (limited to 'addons/google_spreadsheet/static')
-rw-r--r--addons/google_spreadsheet/static/src/js/search.js79
1 files changed, 39 insertions, 40 deletions
diff --git a/addons/google_spreadsheet/static/src/js/search.js b/addons/google_spreadsheet/static/src/js/search.js
index 45759bf3883..650eccdf619 100644
--- a/addons/google_spreadsheet/static/src/js/search.js
+++ b/addons/google_spreadsheet/static/src/js/search.js
@@ -1,51 +1,50 @@
openerp.google_spreadsheet = function(instance) {
var _t = instance.web._t,
- QWeb = instance.web.qweb;
+ QWeb = instance.web.qweb;
instance.web.FormView.include({
- on_processed_onchange: function(result, processed) {
- var self = this;
- var fields = self.fields;
- _(result.selection).each(function (selection, fieldname) {
- var field = fields[fieldname];
- if (!field) { return; }
- field.field.selection = selection;
- field.values = selection;
- field.renderElement();
- });
- return this._super(result, processed);
- },
+ on_processed_onchange: function(result, processed) {
+ var self = this;
+ var fields = self.fields;
+ _(result.selection).each(function (selection, fieldname) {
+ var field = fields[fieldname];
+ if (!field) { return; }
+ field.field.selection = selection;
+ field.values = selection;
+ field.renderElement();
+ });
+ return this._super(result, processed);
+ },
});
instance.web.search.FavoriteMenu.include({
- prepare_dropdown_menu: function (filters) {
- this._super(filters);
- this.$('.favorites-menu').append(QWeb.render('SearchView.addtogooglespreadsheet'));
- this.$('.add-to-spreadsheet').click(this.add_to_spreadsheet.bind(this));
- },
- add_to_spreadsheet: function () {
- var data = this.searchview.build_search_data(),
- model = this.searchview.dataset.model,
- view_manager = this.searchview.getParent(),
- list_view = view_manager.views.list,
- list_view_id = list_view ? list_view.view_id : false,
- context = this.searchview.dataset.get_context() || [],
- domain = this.searchview.dataset.get_domain() || [],
- compound_context = new instance.web.CompoundContext(context),
- compound_domain = new instance.web.CompoundDomain(context),
- groupbys = instance.web.pyeval.eval('groupbys', data.groupbys).join(" "),
- ds = new instance.web.DataSet(this, 'google.drive.config');
+ prepare_dropdown_menu: function (filters) {
+ this._super(filters);
+ this.$('.favorites-menu').append(QWeb.render('SearchView.addtogooglespreadsheet'));
+ this.$('.add-to-spreadsheet').click(this.add_to_spreadsheet.bind(this));
+ },
+ add_to_spreadsheet: function () {
+ var data = this.searchview.build_search_data(),
+ model = this.searchview.dataset.model,
+ view_manager = this.searchview.getParent(),
+ list_view = view_manager.views.list,
+ list_view_id = list_view ? list_view.view_id : false,
+ context = this.searchview.dataset.get_context() || [],
+ domain = this.searchview.dataset.get_domain() || [],
+ compound_context = new instance.web.CompoundContext(context),
+ compound_domain = new instance.web.CompoundDomain(context),
+ groupbys = instance.web.pyeval.eval('groupbys', data.groupbys).join(" "),
+ ds = new instance.web.DataSet(this, 'google.drive.config');
- _.each(data.contexts, compound_context.add, compound_context);
- _.each(data.domains, compound_domain.add, compound_domain);
+ _.each(data.contexts, compound_context.add, compound_context);
+ _.each(data.domains, compound_domain.add, compound_domain);
- compound_domain = JSON.stringify(compound_domain.eval());
- console.log('add_to_spreadsheet');
+ compound_domain = JSON.stringify(compound_domain.eval());
ds.call('set_spreadsheet', [model, compound_domain, groupbys, list_view_id])
- .done(function (res) {
- if (res['url']){
- window.open(res['url'], '_blank');
- }
- });
- },
+ .done(function (res) {
+ if (res['url']){
+ window.open(res['url'], '_blank');
+ }
+ });
+ },
});
}; \ No newline at end of file