|
|
@ -1,8 +1,18 @@ |
|
|
|
openerp.mis_builder = function(instance) { |
|
|
|
odoo.define('mis.builder', function (require) { |
|
|
|
"use strict"; |
|
|
|
|
|
|
|
instance.mis_builder.MisReport = instance.web.form.FormWidget.extend({ |
|
|
|
template: "mis_builder.MisReport", |
|
|
|
var core = require('web.core'); |
|
|
|
var form_common = require('web.form_common'); |
|
|
|
var Model = require('web.DataModel'); |
|
|
|
var data = require('web.data'); |
|
|
|
|
|
|
|
var MisReport = form_common.FormWidget.extend({ |
|
|
|
/** |
|
|
|
* @constructs instance.mis_builder.MisReport |
|
|
|
* @extends instance.web.form.FormWidget |
|
|
|
* |
|
|
|
*/ |
|
|
|
template: "mis_builder.MisReport", |
|
|
|
init: function() { |
|
|
|
this._super.apply(this, arguments); |
|
|
|
this.mis_report_data = null; |
|
|
@ -11,10 +21,10 @@ openerp.mis_builder = function(instance) { |
|
|
|
start: function() { |
|
|
|
this._super.apply(this, arguments); |
|
|
|
var self = this; |
|
|
|
new instance.web.Model("mis.report.instance").call( |
|
|
|
new Model("mis.report.instance").call( |
|
|
|
"compute", |
|
|
|
[self.getParent().dataset.context.active_id], |
|
|
|
{'context': new instance.web.CompoundContext()} |
|
|
|
{'context': new data.CompoundContext()} |
|
|
|
).then(function(result){ |
|
|
|
self.mis_report_data = result; |
|
|
|
self.renderElement(); |
|
|
@ -31,10 +41,10 @@ openerp.mis_builder = function(instance) { |
|
|
|
if (drilldown) { |
|
|
|
var period_id = JSON.parse($(event.target).data("period-id")); |
|
|
|
var val_c = JSON.parse($(event.target).data("expr")); |
|
|
|
new instance.web.Model("mis.report.instance.period").call( |
|
|
|
new Model("mis.report.instance.period").call( |
|
|
|
"drilldown", |
|
|
|
[period_id, val_c], |
|
|
|
{'context': new instance.web.CompoundContext()} |
|
|
|
{'context': new data.CompoundContext()} |
|
|
|
).then(function(result) { |
|
|
|
if (result) { |
|
|
|
self.do_action(result); |
|
|
@ -44,5 +54,6 @@ openerp.mis_builder = function(instance) { |
|
|
|
}, |
|
|
|
}); |
|
|
|
|
|
|
|
instance.web.form.custom_widgets.add('mis_report', 'instance.mis_builder.MisReport'); |
|
|
|
} |
|
|
|
core.form_custom_registry.add('mis_report', MisReport); |
|
|
|
|
|
|
|
}); |