|
@ -20,24 +20,42 @@ var MisReport = form_common.FormWidget.extend({ |
|
|
this.mis_report_instance_id = false; |
|
|
this.mis_report_instance_id = false; |
|
|
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(); |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get_context: function() { |
|
|
get_context: function() { |
|
|
var self = this; |
|
|
var self = this; |
|
|
var context = {}; |
|
|
var context = {}; |
|
@ -46,13 +64,13 @@ var MisReport = form_common.FormWidget.extend({ |
|
|
} |
|
|
} |
|
|
return context; |
|
|
return context; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print: function() { |
|
|
print: function() { |
|
|
var self = this; |
|
|
var self = this; |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
new Model("mis.report.instance").call( |
|
|
new Model("mis.report.instance").call( |
|
|
"print_pdf", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
|
|
|
|
|
|
"print_pdf", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
{'context': context} |
|
|
{'context': context} |
|
|
).then(function(result){ |
|
|
).then(function(result){ |
|
|
self.do_action(result); |
|
|
self.do_action(result); |
|
@ -62,8 +80,8 @@ var MisReport = form_common.FormWidget.extend({ |
|
|
var self = this; |
|
|
var self = this; |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
new Model("mis.report.instance").call( |
|
|
new Model("mis.report.instance").call( |
|
|
"export_xls", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
|
|
|
|
|
|
"export_xls", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
{'context': context} |
|
|
{'context': context} |
|
|
).then(function(result){ |
|
|
).then(function(result){ |
|
|
self.do_action(result); |
|
|
self.do_action(result); |
|
@ -73,8 +91,8 @@ var MisReport = form_common.FormWidget.extend({ |
|
|
var self = this; |
|
|
var self = this; |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
new Model("mis.report.instance").call( |
|
|
new Model("mis.report.instance").call( |
|
|
"display_settings", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
|
|
|
|
|
|
"display_settings", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
{'context': context} |
|
|
{'context': context} |
|
|
).then(function(result){ |
|
|
).then(function(result){ |
|
|
self.do_action(result); |
|
|
self.do_action(result); |
|
@ -84,8 +102,8 @@ var MisReport = form_common.FormWidget.extend({ |
|
|
var self = this; |
|
|
var self = this; |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
var context = new data.CompoundContext(self.build_context(), self.get_context()|| {}); |
|
|
new Model("mis.report.instance").call( |
|
|
new Model("mis.report.instance").call( |
|
|
"compute", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
|
|
|
|
|
|
"compute", |
|
|
|
|
|
[self.mis_report_instance_id], |
|
|
{'context': context} |
|
|
{'context': context} |
|
|
).then(function(result){ |
|
|
).then(function(result){ |
|
|
self.mis_report_data = result; |
|
|
self.mis_report_data = result; |
|
@ -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, |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
}); |
|
|
}); |