|
|
@ -1,19 +1,21 @@ |
|
|
|
odoo.define('account_financial_report.account_financial_report_backend', function (require) { |
|
|
|
'use strict'; |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
var core = require('web.core'); |
|
|
|
var Widget = require('web.Widget'); |
|
|
|
var ControlPanelMixin = require('web.ControlPanelMixin'); |
|
|
|
var ReportWidget = require('account_financial_report.account_financial_report_widget'); |
|
|
|
var core = require('web.core'); |
|
|
|
var Widget = require('web.Widget'); |
|
|
|
var ControlPanelMixin = require('web.ControlPanelMixin'); |
|
|
|
var ReportWidget = require( |
|
|
|
'account_financial_report.account_financial_report_widget' |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
var report_backend = Widget.extend(ControlPanelMixin, { |
|
|
|
var report_backend = Widget.extend(ControlPanelMixin, { |
|
|
|
// Stores all the parameters of the action.
|
|
|
|
events: { |
|
|
|
'click .o_account_financial_reports_print': 'print', |
|
|
|
'click .o_account_financial_reports_export': 'export', |
|
|
|
}, |
|
|
|
init: function(parent, action) { |
|
|
|
init: function (parent, action) { |
|
|
|
this.actionManager = parent; |
|
|
|
this.given_context = {}; |
|
|
|
this.odoo_context = action.context; |
|
|
@ -21,15 +23,16 @@ var report_backend = Widget.extend(ControlPanelMixin, { |
|
|
|
if (action.context.context) { |
|
|
|
this.given_context = action.context.context; |
|
|
|
} |
|
|
|
this.given_context.active_id = action.context.active_id || action.params.active_id; |
|
|
|
this.given_context.active_id = action.context.active_id || |
|
|
|
action.params.active_id; |
|
|
|
this.given_context.model = action.context.active_model || false; |
|
|
|
this.given_context.ttype = action.context.ttype || false; |
|
|
|
return this._super.apply(this, arguments); |
|
|
|
return this._super.apply (this, arguments); |
|
|
|
}, |
|
|
|
willStart: function() { |
|
|
|
willStart: function () { |
|
|
|
return $.when(this.get_html()); |
|
|
|
}, |
|
|
|
set_html: function() { |
|
|
|
set_html: function () { |
|
|
|
var self = this; |
|
|
|
var def = $.when(); |
|
|
|
if (!this.report_widget) { |
|
|
@ -60,8 +63,9 @@ var report_backend = Widget.extend(ControlPanelMixin, { |
|
|
|
return $.when.apply($, defs); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// Updates the control panel and render the elements that have yet to be rendered
|
|
|
|
update_cp: function() { |
|
|
|
// Updates the control panel and render the elements that have yet
|
|
|
|
// to be rendered
|
|
|
|
update_cp: function () { |
|
|
|
if (this.$buttons) { |
|
|
|
var status = { |
|
|
|
breadcrumbs: this.actionManager.get_breadcrumbs(), |
|
|
@ -70,11 +74,11 @@ var report_backend = Widget.extend(ControlPanelMixin, { |
|
|
|
return this.update_control_panel(status); |
|
|
|
} |
|
|
|
}, |
|
|
|
do_show: function() { |
|
|
|
do_show: function () { |
|
|
|
this._super(); |
|
|
|
this.update_cp(); |
|
|
|
}, |
|
|
|
print: function() { |
|
|
|
print: function () { |
|
|
|
var self = this; |
|
|
|
this._rpc({ |
|
|
|
model: this.given_context.model, |
|
|
@ -85,7 +89,7 @@ var report_backend = Widget.extend(ControlPanelMixin, { |
|
|
|
self.do_action(result); |
|
|
|
}); |
|
|
|
}, |
|
|
|
export: function() { |
|
|
|
export: function () { |
|
|
|
var self = this; |
|
|
|
this._rpc({ |
|
|
|
model: this.given_context.model, |
|
|
@ -97,8 +101,11 @@ var report_backend = Widget.extend(ControlPanelMixin, { |
|
|
|
self.do_action(result); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
core.action_registry.add("account_financial_report_backend", report_backend); |
|
|
|
return report_backend; |
|
|
|
core.action_registry.add( |
|
|
|
"account_financial_report_backend", |
|
|
|
report_backend |
|
|
|
); |
|
|
|
return report_backend; |
|
|
|
}); |