summaryrefslogtreecommitdiff
path: root/addons/google_spreadsheet/static
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2017-02-28 11:48:00 +0100
committerAaron Bohy <aab@odoo.com>2017-04-11 19:44:38 +0200
commit5804ed100ec790a36c5ff30a217914950cd78098 (patch)
treea9f7ecf403cc8682c52ecce354ba082e9dee1a7c /addons/google_spreadsheet/static
parente5740270568404d71a3bc093074a085c9c2eded8 (diff)
[IMP] web, *: compute contexts and domains from datapoint
This commit tries to refactore the management of contexts and domains in the webclient. - Get rid of CompoundDomain: use standard array manipulation to join multiple domains or use the Domain class (to be improved) - Get rid of data.js build_domain and build_context methods - Link this.record to the data point from the basic model for all fields (not only relational fields) - Add a getContext and a getDomain function to the basic model data point (localData element) so that AbstractField implementations can use them thanks to their this.record element. - Remove the autocontext binding for field RPCs (see FieldManagerMixin)
Diffstat (limited to 'addons/google_spreadsheet/static')
-rw-r--r--addons/google_spreadsheet/static/src/js/search.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/addons/google_spreadsheet/static/src/js/search.js b/addons/google_spreadsheet/static/src/js/search.js
index 0a08667e26a..b715282e551 100644
--- a/addons/google_spreadsheet/static/src/js/search.js
+++ b/addons/google_spreadsheet/static/src/js/search.js
@@ -2,9 +2,9 @@ odoo.define('google_spreadsheet.google.spreadsheet', function (require) {
"use strict";
var ActionManager = require('web.ActionManager');
-var Context = require('web.Context');
var core = require('web.core');
var data = require('web.data');
+var Domain = require('web.Domain');
var FavoriteMenu = require('web.FavoriteMenu');
var pyeval = require('web.pyeval');
var ViewManager = require('web.ViewManager');
@@ -14,7 +14,7 @@ var QWeb = core.qweb;
FavoriteMenu.include({
start: function () {
this._super();
- var am = this.findAncestor(function(a) {
+ var am = this.findAncestor(function (a) {
return a instanceof ActionManager;
});
if (am && am.get_inner_widget() instanceof ViewManager) {
@@ -28,17 +28,14 @@ FavoriteMenu.include({
model = this.searchview.dataset.model,
list_view = this.view_manager.views.list,
list_view_id = list_view ? list_view.view_id : false,
- context = this.searchview.dataset.get_context() || [],
- compound_context = new Context(context),
- compound_domain = new data.CompoundDomain(context),
+ domain = [],
groupbys = pyeval.eval('groupbys', sv_data.groupbys).join(" "),
ds = new data.DataSet(this, 'google.drive.config');
- _.each(sv_data.contexts, compound_context.add, compound_context);
- _.each(sv_data.domains, compound_domain.add, compound_domain);
-
- compound_domain = JSON.stringify(compound_domain.eval());
- ds.call('set_spreadsheet', [model, compound_domain, groupbys, list_view_id])
+ _.each(sv_data.domains, function (d) {
+ domain.push(Domain.prototype.stringToArray(d));
+ });
+ ds.call('set_spreadsheet', [model, Domain.prototype.arrayToString(domain), groupbys, list_view_id])
.done(function (res) {
if (res.url){
window.open(res.url, '_blank');