Browse Source

Merge pull request #232 from acsone/9.0-imp-mis-builder-widget

[IMP] Add refresh button in mis report preview. Widget code changes to allow to add fields in the widget easier
pull/237/head
Stéphane Bidoul (ACSONE) 8 years ago
committed by GitHub
parent
commit
aaee603e38
  1. 6
      mis_builder/CHANGES.rst
  2. 2
      mis_builder/__openerp__.py
  3. 36
      mis_builder/static/src/js/mis_builder.js
  4. 1
      mis_builder/static/src/xml/mis_widget.xml

6
mis_builder/CHANGES.rst

@ -6,6 +6,12 @@ Changelog
.. ..
.. * .. *
9.0.2.0.2 (2016-09-27)
~~~~~~~~~~~~~~~~~~~~~~
* [IMP] Add refresh button in mis report preview.
Widget code changes to allow to add fields in the widget easier
9.0.2.0.1 (2016-05-26) 9.0.2.0.1 (2016-05-26)
~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~

2
mis_builder/__openerp__.py

@ -4,7 +4,7 @@
{ {
'name': 'MIS Builder', 'name': 'MIS Builder',
'version': '9.0.2.0.1',
'version': '9.0.2.0.2',
'category': 'Reporting', 'category': 'Reporting',
'summary': """ 'summary': """
Build 'Management Information System' Reports and Dashboards Build 'Management Information System' Reports and Dashboards

36
mis_builder/static/src/js/mis_builder.js

@ -21,20 +21,38 @@ var MisReport = form_common.FormWidget.extend({
this.field_manager.on("view_content_has_changed", this, this.reload_widget); this.field_manager.on("view_content_has_changed", this, this.reload_widget);
}, },
reload_widget: function() {
initialize_field: function() {
var self = this; var self = this;
self.mis_report_instance_id = self.getParent().datarecord.id;
if (self.mis_report_instance_id) {
self.generate_content();
self.destroy_content();
self.init_fields();
},
init_fields: function() {
var self = this;
if (self.dfm)
return;
self.dfm = new form_common.DefaultFieldManager(self);
self.$(".oe_mis_builder_generate_content").click(_.bind(this.generate_content, this));
},
destroy_content: function() {
if (this.dfm) {
this.dfm.destroy();
this.dfm = undefined;
} }
}, },
reload_widget: function() {
},
start: function() { start: function() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
var self = this; var self = this;
self.mis_report_instance_id = self.getParent().datarecord.id; self.mis_report_instance_id = self.getParent().datarecord.id;
if (self.mis_report_instance_id) { if (self.mis_report_instance_id) {
self.getParent().dataset.context.no_destroy = true; self.getParent().dataset.context.no_destroy = true;
self.generate_content();
} }
}, },
@ -104,6 +122,7 @@ var MisReport = form_common.FormWidget.extend({
self.$(".oe_mis_builder_settings").show(); self.$(".oe_mis_builder_settings").show();
} }
}); });
self.initialize_field();
}, },
events: { events: {
"click a.mis_builder_drilldown": "drilldown", "click a.mis_builder_drilldown": "drilldown",
@ -111,11 +130,13 @@ var MisReport = form_common.FormWidget.extend({
drilldown: function(event) { drilldown: function(event) {
var self = this; var self = this;
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {});
var drilldown = $(event.target).data("drilldown"); var drilldown = $(event.target).data("drilldown");
if (drilldown) { if (drilldown) {
new Model("mis.report.instance").call( new Model("mis.report.instance").call(
"drilldown", "drilldown",
[self.mis_report_instance_id, drilldown]
[self.mis_report_instance_id, drilldown],
{'context': context}
).then(function(result) { ).then(function(result) {
if (result) { if (result) {
self.do_action(result); self.do_action(result);
@ -144,4 +165,9 @@ ActionManager.include({
} }
}); });
core.form_custom_registry.add('mis_report', MisReport); core.form_custom_registry.add('mis_report', MisReport);
return {
MisReport: MisReport,
};
}); });

1
mis_builder/static/src/xml/mis_widget.xml

@ -4,6 +4,7 @@
<t t-if="widget.mis_report_data"> <t t-if="widget.mis_report_data">
<h2><t t-esc="widget.mis_report_data.report_name" /></h2> <h2><t t-esc="widget.mis_report_data.report_name" /></h2>
<div class="oe_mis_builder_buttons oe_right oe_button_box"> <div class="oe_mis_builder_buttons oe_right oe_button_box">
<button class="oe_mis_builder_generate_content btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-refresh.png"/> Refresh</button>
<button class="oe_mis_builder_print btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-print.png"/> Print</button> <button class="oe_mis_builder_print btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-print.png"/> Print</button>
<button class="oe_mis_builder_export btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-go-down.png"/>Export</button> <button class="oe_mis_builder_export btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-go-down.png"/>Export</button>
<button style="display: none;" class="oe_mis_builder_settings btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-execute.png"/> Settings</button> <button style="display: none;" class="oe_mis_builder_settings btn btn-sm oe_button"><img src="/web/static/src/img/icons/gtk-execute.png"/> Settings</button>

Loading…
Cancel
Save