diff --git a/bi_view_editor/README.rst b/bi_view_editor/README.rst
index d7f372bf..3faf6e0c 100644
--- a/bi_view_editor/README.rst
+++ b/bi_view_editor/README.rst
@@ -38,10 +38,10 @@ To graphically design your analysis data-set:
- From the Reporting menu, select "Custom BI Views"
- Browse trough the business objects in the Query tab
- Pick the interesting fields (Drag & Drop)
+- For each selected field, right-click on the Options column and select whether it's a row, column or measure
- Save and click "Generate BI View"
-
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/143/9.0
@@ -49,9 +49,12 @@ To graphically design your analysis data-set:
Known issues / Roadmap
======================
-* Non-stored fields are not supported yet
-* Provide graph view for table relations (would be a "nice to have")
-* Porting to Odoo 9.0
+* Non-stored fields are not supported
+* Provide graph view for table relations
+* Use the same concept (dinamically create list views) to build reports: generate an ad-hoc query object that displays the fields that you want for the report, for a given join query
+* Add possibility to store the BI view in user dashboard, like any other graph or cross table
+* Provide a tutorial (eg. a working example of usage)
+
Bug Tracker
===========
diff --git a/bi_view_editor/__openerp__.py b/bi_view_editor/__openerp__.py
index 40ab1473..fb26ff0a 100644
--- a/bi_view_editor/__openerp__.py
+++ b/bi_view_editor/__openerp__.py
@@ -27,8 +27,4 @@
'js': [
'static/src/js/bve.js'
],
- 'demo': [],
- 'installable': True,
- 'auto_install': False,
- 'application': False,
}
diff --git a/bi_view_editor/models/ir_model.py b/bi_view_editor/models/ir_model.py
index 2bc6ee03..f898b026 100644
--- a/bi_view_editor/models/ir_model.py
+++ b/bi_view_editor/models/ir_model.py
@@ -204,17 +204,12 @@ class IrModel(models.Model):
self.instanciate(cr, user, vals['model'], context)
self.pool.setup_models(cr, partial=(not self.pool.ready))
- # update database schema
- # model = self.pool[vals['model']]
- # ctx = dict(
- # context,
- # field_name=vals['name'],
- # field_state='manual',
- # select=vals.get('select_level', '0'),
- # update_custom_fields=True)
RegistryManager.signal_registry_change(cr.dbname)
-# self.write(cr, user, [res], {'state': 'manual'})
+ # Following commented line (write method) is not working anymore
+ # as in Odoo V9 a new orm constraint is restricting the modification
+ # of the state while updating ir.model
+ # self.write(cr, user, [res], {'state': 'manual'})
q = ("""UPDATE ir_model SET state = 'manual'
WHERE id = """ + str(res))
diff --git a/bi_view_editor/static/src/js/bve.js b/bi_view_editor/static/src/js/bve.js
index c1a9dd0f..c0be9b52 100644
--- a/bi_view_editor/static/src/js/bve.js
+++ b/bi_view_editor/static/src/js/bve.js
@@ -28,9 +28,9 @@ openerp.bi_view_editor = function (instance, local) {
}
});
if (!this.get("effective_readonly")) {
- this.$el.find('.search-bar').attr('disabled', false);
- this.$el.find('.class-list').css('opacity', '1');
- this.$el.find('.class-list .class').css('cursor', 'pointer');
+ this.$el.find('.search-bar').attr('disabled', false);
+ this.$el.find('.class-list').css('opacity', '1');
+ this.$el.find('.class-list .class').css('cursor', 'pointer');
this.$el.find(".body .right").droppable("option", "disabled", false);
this.$el.find('#clear').css('display', 'inline-block').click(function () {
self.set_fields([]);
@@ -43,9 +43,9 @@ openerp.bi_view_editor = function (instance, local) {
} else {
this.$el.find(".body .right").droppable("option", "disabled", true);
this.$el.find('#clear').css('display', 'none');
- this.$el.find('.search-bar').attr('disabled', true);
- this.$el.find('.class-list').css('opacity', '.35');
- this.$el.find('.class-list .class').css('cursor', 'default');
+ this.$el.find('.search-bar').attr('disabled', true);
+ this.$el.find('.class-list').css('opacity', '.35');
+ this.$el.find('.class-list .class').css('cursor', 'default');
}
},
filter: function(val) {
@@ -79,18 +79,16 @@ openerp.bi_view_editor = function (instance, local) {
this.set_fields(JSON.parse(this.get('value')));
},
load_classes: function(scrollTo) {
- scrollTo = (typeof scrollTo == 'undefined') ? false : scrollTo;
+ scrollTo = (typeof scrollTo == 'undefined') ? false : scrollTo;
var self = this;
var model = new instance.web.Model("ir.model");
if (this.$el.find(".field-list tbody tr").length > 0) {
model.call("get_related_models", [this.get_model_ids()], { context: new instance.web.CompoundContext() }).then(function(result) {
self.show_classes(result);
- //if(scrollTo) self.$el.find('.class-list').scrollTo('#bve-class-' + scrollTo.model_id);
});
} else {
model.call("get_models", { context: new instance.web.CompoundContext() }).then(function(result) {
self.show_classes(result);
- //if(scrollTo) self.$el.find('.class-list').scrollTo('#bve-class-' + scrollTo.model_id);
});
}
},
@@ -99,13 +97,13 @@ openerp.bi_view_editor = function (instance, local) {
var model = new instance.web.Model("ir.model");
self.$el.find(".class-list .class").remove();
self.$el.find(".class-list .field").remove();
- var css = this.get('effective_readonly') ? 'cursor: default' : 'cursor: pointer'
-
+ var css = this.get('effective_readonly') ? 'cursor: default' : 'cursor: pointer';
+
for (var i = 0; i < result.length; i++) {
- var item = $("
" + result[i]["name"] + "
")
+ var item = $("" + result[i].name + "
")
.data('model-data', result[i])
.click(function (evt) {
- if(self.get("effective_readonly")) return;
+ if(self.get("effective_readonly")) return;
var classel = $(this);
if (classel.data('bve-processed')) {
@@ -114,12 +112,12 @@ openerp.bi_view_editor = function (instance, local) {
var index = self.activeModelMenus.indexOf(classel.data('model-data').id);
if(index != -1) self.activeModelMenus.splice(index, 1);
} else {
- self.activeModelMenus.push(classel.data('model-data').id);
+ self.activeModelMenus.push(classel.data('model-data').id);
model.call("get_fields", [classel.data('model-data').id], { context: new instance.web.CompoundContext() }).then(function(result) {
for (var i = 0; i < result.length; i++) {
- classel.find("#bve-field-" + result[i]["name"]).remove();
- if(self.$el.find(".field-list tbody [name=label-" + result[i].id + "]").length > 0) continue;
- classel.after($("" + result[i]["description"] + "
")
+ classel.find("#bve-field-" + result[i].name).remove();
+ if(self.$el.find(".field-list tbody [name=label-" + result[i].id + "]").length > 0) continue;
+ classel.after($("" + result[i].description + "
")
.data('field-data', result[i])
.click(function () {
if (!self.get("effective_readonly")) {
@@ -133,7 +131,7 @@ openerp.bi_view_editor = function (instance, local) {
'appendTo': 'body',
'containment': 'window'
})
- );
+ );
}
});
@@ -149,8 +147,8 @@ openerp.bi_view_editor = function (instance, local) {
console.log(result);
var item = self.$el.find(".class-list #bve-class-" + result[0].model_id);
for (var o = 0; o < result.length; o++) {
- if(self.$el.find(".field-list tbody [name=label-" + result[o].id + "]").length > 0) continue;
- item.after($("" + result[o]["description"] + "
")
+ if(self.$el.find(".field-list tbody [name=label-" + result[o].id + "]").length > 0) continue;
+ item.after($("" + result[o].description + "
")
.data('field-data', result[o])
.click(function () {
if (!self.get("effective_readonly")) {
@@ -173,7 +171,7 @@ openerp.bi_view_editor = function (instance, local) {
},
add_field_to_table: function(data, options) {
- var self = this;
+ var self = this;
if (typeof data.row == 'undefined') {
data.row = false;
}
@@ -206,7 +204,7 @@ openerp.bi_view_editor = function (instance, local) {
.data('field-data', data)
.contextmenu(function(e) {
e.preventDefault();
- if (self.get("effective_readonly")) return;
+ if (self.get("effective_readonly")) return;
var target = $(e.currentTarget);
var currentFieldData = target.data('field-data');
@@ -272,29 +270,29 @@ openerp.bi_view_editor = function (instance, local) {
self.update_field_view(target);
self.internal_set_value(JSON.stringify(self.get_fields()));
});
- contextMenu.show();
-
+ contextMenu.show();
+
$(document).mouseup(function (e) {
var container = $(".context-menu");
-
- if (!container.is(e.target) // if the target of the click isn't the container...
- && container.has(e.target).length === 0) // ... nor a descendant of the container
+
+ // if the target of the click isn't the container nor a descendant of the container
+ if (!container.is(e.target) && container.has(e.target).length === 0)
{
container.hide();
}
- });
-
+ });
+
})
- );
-
- self.$el.find('.delete-button').unbind("click");
+ );
+
+ self.$el.find('.delete-button').unbind("click");
self.$el.find('.delete-button').click(function() {
$(this).closest('tr').remove();
self.clean_join_nodes();
self.internal_set_value(JSON.stringify(self.get_fields()));
self.load_classes();
return false;
- })
+ });
},
clean_join_nodes: function () {
var aliases = $.makeArray(this.$el.find(".field-list tbody tr").map(function (idx, el) {
@@ -359,8 +357,7 @@ openerp.bi_view_editor = function (instance, local) {
var field_data = this.get_fields();
var self = this;
model.call('get_join_nodes', [field_data, data], {context: new instance.web.CompoundContext()}).then(function(result) {
- //self.$el.find(".search-bar").val("");
- //self.filter("");
+
if (result.length == 1) {
self.add_field_and_join_node(data, result[0]);
self.internal_set_value(JSON.stringify(self.get_fields()));
@@ -386,7 +383,7 @@ openerp.bi_view_editor = function (instance, local) {
}));
},
set_fields: function(values) {
- this.activeModelMenus = [];
+ this.activeModelMenus = [];
if (!values) {
values = [];
}
@@ -417,9 +414,9 @@ openerp.bi_view_editor = function (instance, local) {
description = "Use the field on table " + model_data[choices[i].table_alias].model_name;
} else {
if (choices[i].join_node == -1) {
- description = "Join using the field '" + choices[i]['description'] + "' from model '" + choices[i]['model_name'] + "'";
+ description = "Join using the field '" + choices[i].description + "' from model '" + choices[i].model_name + "'";
} else {
- description = "Join using the field '" + choices[i]['description'] + "' from new model '" + choices[i]['model_name'] + "'";
+ description = "Join using the field '" + choices[i].description + "' from new model '" + choices[i].model_name + "'";
}
}
joinnodes.append($("" + description+ "")
@@ -437,12 +434,8 @@ openerp.bi_view_editor = function (instance, local) {
joinnodes.find('a').click(function() {
callback(callback_data, choices[$(this).data('idx')]);
dialog.close();
- })
+ });
- //dialog.on('closing', this, function (e){
- // self.check_exit(true);
- //});
- //this.$buttonpane = dialog.$buttons;
this.start();
}
});
diff --git a/bi_view_editor/templates/qweb_template.xml b/bi_view_editor/templates/qweb_template.xml
index a1859ac1..fae5371b 100644
--- a/bi_view_editor/templates/qweb_template.xml
+++ b/bi_view_editor/templates/qweb_template.xml
@@ -11,17 +11,7 @@