Browse Source
Merge pull request #503 from i-vyshnevska/10-fix-account-financial-report-qweb-reconcile
Merge pull request #503 from i-vyshnevska/10-fix-account-financial-report-qweb-reconcile
[10.0][FIX] account_financial_report_qweb: Link reconcile model instead just namepull/508/head
Pedro M. Baeza
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 189 additions and 163 deletions
-
1account_financial_report_qweb/report/abstract_report.py
-
6account_financial_report_qweb/report/general_ledger.py
-
5account_financial_report_qweb/report/general_ledger_xlsx.py
-
1account_financial_report_qweb/report/open_items.py
-
14account_financial_report_qweb/report/templates/general_ledger.xml
-
4account_financial_report_qweb/report/templates/open_items.xml
-
182account_financial_report_qweb/static/src/js/account_financial_report_qweb_backend.js
-
138account_financial_report_qweb/static/src/js/account_financial_report_qweb_widgets.js
-
1customer_activity_statement/report/customer_activity_statement.py
@ -1,95 +1,99 @@ |
|||||
odoo.define('account_financial_report_qweb.account_financial_report_backend', function (require) { |
odoo.define('account_financial_report_qweb.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_qweb.account_financial_report_widget'); |
|
||||
var Model = require('web.Model'); |
|
||||
|
var core = require('web.core'); |
||||
|
var Widget = require('web.Widget'); |
||||
|
var ControlPanelMixin = require('web.ControlPanelMixin'); |
||||
|
var ReportWidget = require( |
||||
|
'account_financial_report_qweb.account_financial_report_widget'); |
||||
|
var Model = require('web.Model'); |
||||
|
|
||||
|
|
||||
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) { |
|
||||
this.actionManager = parent; |
|
||||
this.given_context = {}; |
|
||||
this.odoo_context = action.context; |
|
||||
this.controller_url = action.context.url; |
|
||||
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.model = action.context.active_model || false; |
|
||||
this.given_context.ttype = action.context.ttype || false; |
|
||||
return this._super.apply(this, arguments); |
|
||||
}, |
|
||||
willStart: function() { |
|
||||
return $.when(this.get_html()); |
|
||||
}, |
|
||||
set_html: function() { |
|
||||
var self = this; |
|
||||
var def = $.when(); |
|
||||
if (!this.report_widget) { |
|
||||
this.report_widget = new ReportWidget(this, this.given_context); |
|
||||
def = this.report_widget.appendTo(this.$el); |
|
||||
} |
|
||||
def.then(function () { |
|
||||
self.report_widget.$el.html(self.html); |
|
||||
}); |
|
||||
}, |
|
||||
start: function() { |
|
||||
this.set_html(); |
|
||||
return this._super(); |
|
||||
}, |
|
||||
// Fetches the html and is previous report.context if any, else create it
|
|
||||
get_html: function() { |
|
||||
var self = this; |
|
||||
var defs = []; |
|
||||
self.model = new Model(this.given_context.model); |
|
||||
return self.model.call('get_html', [this.given_context], {context: self.odoo_context}).then(function |
|
||||
(result) { |
|
||||
self.html = result.html; |
|
||||
defs.push(self.update_cp()); |
|
||||
return $.when.apply($, defs); |
|
||||
}); |
|
||||
}, |
|
||||
// Updates the control panel and render the elements that have yet to be rendered
|
|
||||
update_cp: function() { |
|
||||
if (!this.$buttons) { |
|
||||
|
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) { |
||||
|
this.actionManager = parent; |
||||
|
this.given_context = {}; |
||||
|
this.odoo_context = action.context; |
||||
|
this.controller_url = action.context.url; |
||||
|
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.model = action.context.active_model || false; |
||||
|
this.given_context.ttype = action.context.ttype || false; |
||||
|
return this._super.apply(this, arguments); |
||||
|
}, |
||||
|
willStart: function () { |
||||
|
return $.when(this.get_html()); |
||||
|
}, |
||||
|
set_html: function () { |
||||
|
var self = this; |
||||
|
var def = $.when(); |
||||
|
if (!this.report_widget) { |
||||
|
this.report_widget = new ReportWidget(this, this.given_context); |
||||
|
def = this.report_widget.appendTo(this.$el); |
||||
|
} |
||||
|
def.then(function () { |
||||
|
self.report_widget.$el.html(self.html); |
||||
|
}); |
||||
|
}, |
||||
|
start: function () { |
||||
|
this.set_html(); |
||||
|
return this._super(); |
||||
|
}, |
||||
|
// Fetches the html and is previous report.context if any,
|
||||
|
// else create it
|
||||
|
get_html: function () { |
||||
|
var self = this; |
||||
|
var defs = []; |
||||
|
self.model = new Model(this.given_context.model); |
||||
|
return self.model.call('get_html', [this.given_context], |
||||
|
{context: self.odoo_context}).then(function (result) { |
||||
|
self.html = result.html; |
||||
|
defs.push(self.update_cp()); |
||||
|
return $.when.apply($, defs); |
||||
|
}); |
||||
|
}, |
||||
|
// Updates the control panel and render the elements that have yet to
|
||||
|
// be rendered
|
||||
|
update_cp: function () { |
||||
|
var status = { |
||||
|
breadcrumbs: this.actionManager.get_breadcrumbs(), |
||||
|
cp_content: {$buttons: this.$buttons}, |
||||
|
}; |
||||
|
return this.update_control_panel(status); |
||||
|
}, |
||||
|
do_show: function () { |
||||
|
this._super(); |
||||
|
this.update_cp(); |
||||
|
}, |
||||
|
print: function () { |
||||
|
var self = this; |
||||
|
self.model = new Model(this.given_context.model); |
||||
|
self.model.call('print_report', [this.given_context.active_id, |
||||
|
'qweb-pdf'], {context: self.odoo_context}) |
||||
|
.then(function (result) { |
||||
|
self.do_action(result); |
||||
|
}); |
||||
|
}, |
||||
|
export: function () { |
||||
|
var self = this; |
||||
|
self.model = new Model(this.given_context.model); |
||||
|
self.model.call('print_report', [this.given_context.active_id, |
||||
|
'xlsx'], {context: self.odoo_context}) |
||||
|
.then(function (result) { |
||||
|
self.do_action(result); |
||||
|
}); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
} |
|
||||
var status = { |
|
||||
breadcrumbs: this.actionManager.get_breadcrumbs(), |
|
||||
cp_content: {$buttons: this.$buttons}, |
|
||||
}; |
|
||||
return this.update_control_panel(status); |
|
||||
}, |
|
||||
do_show: function() { |
|
||||
this._super(); |
|
||||
this.update_cp(); |
|
||||
}, |
|
||||
print: function() { |
|
||||
var self = this; |
|
||||
self.model = new Model(this.given_context.model); |
|
||||
self.model.call('print_report', [this.given_context.active_id, 'qweb-pdf'], {context: self.odoo_context}) |
|
||||
.then(function(result){ |
|
||||
self.do_action(result); |
|
||||
}); |
|
||||
}, |
|
||||
export: function() { |
|
||||
var self = this; |
|
||||
self.model = new Model(this.given_context.model); |
|
||||
self.model.call('print_report', [this.given_context.active_id, 'xlsx'], {context: self.odoo_context}) |
|
||||
.then(function(result){ |
|
||||
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; |
||||
}); |
}); |
@ -1,69 +1,85 @@ |
|||||
odoo.define('account_financial_report_qweb.account_financial_report_widget', function |
odoo.define('account_financial_report_qweb.account_financial_report_widget', function |
||||
(require) { |
(require) { |
||||
'use strict'; |
|
||||
|
'use strict'; |
||||
|
|
||||
var Widget = require('web.Widget'); |
|
||||
|
var Widget = require('web.Widget'); |
||||
|
|
||||
|
|
||||
var accountFinancialReportWidget = Widget.extend({ |
|
||||
events: { |
|
||||
'click .o_account_financial_reports_web_action': 'boundLink', |
|
||||
'click .o_account_financial_reports_web_action_multi': 'boundLinkmulti', |
|
||||
'click .o_account_financial_reports_web_action_monetary': 'boundLinkMonetary', |
|
||||
'click .o_account_financial_reports_web_action_monetary_multi': 'boundLinkMonetarymulti', |
|
||||
}, |
|
||||
init: function() { |
|
||||
this._super.apply(this, arguments); |
|
||||
}, |
|
||||
start: function() { |
|
||||
return this._super.apply(this, arguments); |
|
||||
}, |
|
||||
boundLink: function(e) { |
|
||||
var res_model = $(e.target).data('res-model'); |
|
||||
var res_id = $(e.target).data('active-id'); |
|
||||
return this.do_action({ |
|
||||
type: 'ir.actions.act_window', |
|
||||
res_model: res_model, |
|
||||
res_id: res_id, |
|
||||
views: [[false, 'form']], |
|
||||
target: 'current' |
|
||||
}); |
|
||||
}, |
|
||||
boundLinkmulti: function(e) { |
|
||||
var res_model = $(e.target).data('res-model'); |
|
||||
var domain = $(e.target).data('domain'); |
|
||||
return this.do_action({ |
|
||||
type: 'ir.actions.act_window', |
|
||||
res_model: res_model, |
|
||||
domain: domain, |
|
||||
views: [[false, "list"], [false, "form"]], |
|
||||
target: 'current' |
|
||||
}); |
|
||||
}, |
|
||||
boundLinkMonetary: function(e) { |
|
||||
var res_model = $(e.target.parentElement).data('res-model'); |
|
||||
var res_id = $(e.target.parentElement).data('active-id'); |
|
||||
return this.do_action({ |
|
||||
type: 'ir.actions.act_window', |
|
||||
res_model: res_model, |
|
||||
res_id: res_id, |
|
||||
views: [[false, 'form']], |
|
||||
target: 'current' |
|
||||
}); |
|
||||
}, |
|
||||
boundLinkMonetarymulti: function(e) { |
|
||||
var res_model = $(e.target.parentElement).data('res-model'); |
|
||||
var domain = $(e.target.parentElement).data('domain'); |
|
||||
return this.do_action({ |
|
||||
type: 'ir.actions.act_window', |
|
||||
res_model: res_model, |
|
||||
domain: domain, |
|
||||
views: [[false, "list"], [false, "form"]], |
|
||||
target: 'current' |
|
||||
}); |
|
||||
}, |
|
||||
}); |
|
||||
|
var accountFinancialReportWidget = Widget.extend({ |
||||
|
events: { |
||||
|
'click .o_account_financial_reports_web_action': |
||||
|
'boundLink', |
||||
|
'click .o_account_financial_reports_web_action_multi': |
||||
|
'boundLinkmulti', |
||||
|
'click .o_account_financial_reports_web_action_monetary': |
||||
|
'boundLinkMonetary', |
||||
|
'click .o_account_financial_reports_web_action_monetary_multi': |
||||
|
'boundLinkMonetarymulti', |
||||
|
}, |
||||
|
init: function () { |
||||
|
this._super.apply(this, arguments); |
||||
|
}, |
||||
|
start: function () { |
||||
|
return this._super.apply(this, arguments); |
||||
|
}, |
||||
|
boundLink: function (e) { |
||||
|
var res_model = $(e.target).data('res-model'); |
||||
|
var res_id = $(e.target).data('active-id'); |
||||
|
return this.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
res_model: res_model, |
||||
|
res_id: res_id, |
||||
|
views: [[false, 'form']], |
||||
|
target: 'current', |
||||
|
}); |
||||
|
}, |
||||
|
boundLinkmulti: function (e) { |
||||
|
var res_model = $(e.target).data('res-model'); |
||||
|
var domain = $(e.target).data('domain'); |
||||
|
return this.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
res_model: res_model, |
||||
|
domain: domain, |
||||
|
views: [[false, "list"], [false, "form"]], |
||||
|
target: 'current', |
||||
|
}); |
||||
|
}, |
||||
|
boundLinkMonetary: function (e) { |
||||
|
var res_model = $(e.target).data('res-model'); |
||||
|
var res_id = $(e.target).data('active-id'); |
||||
|
// check if we call on appropriate element, amount been wrapped in
|
||||
|
// a span by a monetary widget
|
||||
|
if (e.target.localName === 'span' ) { |
||||
|
res_model = $(e.target.parentElement).data('res-model'); |
||||
|
res_id = $(e.target.parentElement).data('active-id'); |
||||
|
} |
||||
|
return this.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
res_model: res_model, |
||||
|
res_id: res_id, |
||||
|
views: [[false, 'form']], |
||||
|
target: 'current', |
||||
|
}); |
||||
|
}, |
||||
|
boundLinkMonetarymulti: function (e) { |
||||
|
var res_model = $(e.target).data('res-model'); |
||||
|
var domain = $(e.target).data('domain'); |
||||
|
// check if we call on appropriate element, amount been wrapped in
|
||||
|
// a span by a monetary widget
|
||||
|
if (e.target.localName === 'span' ) { |
||||
|
res_model = $(e.target.parentElement).data('res-model'); |
||||
|
domain = $(e.target.parentElement).data('domain'); |
||||
|
} |
||||
|
return this.do_action({ |
||||
|
type: 'ir.actions.act_window', |
||||
|
res_model: res_model, |
||||
|
domain: domain, |
||||
|
views: [[false, "list"], [false, "form"]], |
||||
|
target: 'current', |
||||
|
}); |
||||
|
}, |
||||
|
}); |
||||
|
|
||||
return accountFinancialReportWidget; |
|
||||
|
return accountFinancialReportWidget; |
||||
|
|
||||
}); |
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue