mirror of
https://github.com/OCA/report-print-send.git
synced 2025-02-16 07:11:31 +02:00
[FIX] base_report_to_printer: Stateless tests (#122)
If the test was run in a database with the `account` module installed, they were failing for 2 reasons: - It was searching for the first report it could find, with the first 5 records to report. This made it load the `account.report_agedpartnerbalance` report, which caused a fake `TypeError: 'NoneType' object has no attribute '__getitem__'` error. - It was running tests without loading the full module graph, thus not getting the default value for the new required `invoice_warn` field. Now tests are run in `post_install` mode to load full module graph, and they use stateless data.
This commit is contained in:
committed by
Pedro M. Baeza
parent
44a1df2700
commit
8b5c4f3fb0
@@ -8,25 +8,25 @@ odoo.define('base_report_to_printer.print', function(require) {
|
||||
|
||||
ActionManager.include({
|
||||
ir_actions_report_xml: function(action, options) {
|
||||
action = _.clone(action);
|
||||
var _action = _.clone(action);
|
||||
var _t = core._t;
|
||||
var self = this;
|
||||
var _super = this._super;
|
||||
|
||||
if ('report_type' in action && action.report_type === 'qweb-pdf') {
|
||||
if ('report_type' in _action && _action.report_type === 'qweb-pdf') {
|
||||
framework.blockUI();
|
||||
new Model('ir.actions.report.xml')
|
||||
.call('print_action_for_report_name', [action.report_name])
|
||||
.call('print_action_for_report_name', [_action.report_name])
|
||||
.then(function(print_action){
|
||||
if (print_action && print_action.action === 'server') {
|
||||
framework.unblockUI();
|
||||
new Model('report')
|
||||
.call('print_document',
|
||||
[action.context.active_ids,
|
||||
action.report_name,
|
||||
[_action.context.active_ids,
|
||||
_action.report_name,
|
||||
],
|
||||
{data: action.data || {},
|
||||
context: action.context || {},
|
||||
{data: _action.data || {},
|
||||
context: _action.context || {},
|
||||
})
|
||||
.then(function(){
|
||||
self.do_notify(_t('Report'),
|
||||
@@ -37,14 +37,12 @@ odoo.define('base_report_to_printer.print', function(require) {
|
||||
|
||||
});
|
||||
} else {
|
||||
return _super.apply(self, [action, options]);
|
||||
return _super.apply(self, [_action, options]);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return _super.apply(self, [action, options]);
|
||||
return _super.apply(self, [_action, options]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user