[FIX] account: reconciliation widget fetch correct reconciliation models
Have a reconciliation model that applies to some particular journals
And that will match some of those journals' lines
The field journal should be filled too
(this field is only the default journal that a proposition will be filled with)
Open the reconciliation widget on a given journal, within the list of
possible journal (from the account dashboard)
Before this commit there was a crashed. This was caused by the fact that
one of the lines that should be displayed had a reconcile model that was not fetched beforehand
After this commit, there is no crash as all relevant reconcile
models are fetched
Note that, on reconcile models, the field journal_id is just there to prefill
the propositions it will create
corrects commit e5c8071484
OPW 2084942
closes odoo/odoo#38836
X-original-commit: c285d578cc497044e819c62d42373c29f87b1e93
Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
This commit is contained in:
committed by
fw-bot
parent
ae82f17cc9
commit
f703271c0a
@@ -438,7 +438,7 @@ var StatementModel = BasicModel.extend({
|
||||
domainReconcile.push(['company_id', 'in', self.context.company_ids]);
|
||||
}
|
||||
if (self.context && self.context.active_model === 'account.journal' && self.context.active_ids) {
|
||||
domainReconcile.push(['journal_id', 'in', [false].concat(self.context.active_ids)]);
|
||||
domainReconcile.push(['match_journal_ids', 'in', [false].concat(self.context.active_ids)]);
|
||||
}
|
||||
var def_reconcileModel = this._loadReconciliationModel({domainReconcile: domainReconcile});
|
||||
var def_account = this._rpc({
|
||||
|
||||
@@ -589,6 +589,7 @@ var demoData = require('account.reconciliation_tests.data');
|
||||
|
||||
var testUtils = require('web.test_utils');
|
||||
var testUtilsDom = require('web.test_utils_dom');
|
||||
var testUtilsMock = require('web.test_utils_mock');
|
||||
|
||||
QUnit.module('account', {
|
||||
beforeEach: function () {
|
||||
@@ -1329,6 +1330,36 @@ QUnit.module('account', {
|
||||
clientAction.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('Reconciliation fetch correct reconciliation models', async function (assert) {
|
||||
assert.expect(1);
|
||||
|
||||
testUtilsMock.patch(this.params.options.context, {
|
||||
active_model: 'account.journal', // On account dashboard, click "Reconcile" on a journal
|
||||
active_ids: [1,2], // Active journals
|
||||
company_ids: [3,4], // Active companies
|
||||
});
|
||||
|
||||
var clientAction = new ReconciliationClientAction.StatementAction(null, this.params.options);
|
||||
|
||||
testUtils.addMockEnvironment(clientAction, {
|
||||
data: this.params.data,
|
||||
mockRPC: async function (route, args) {
|
||||
if (args.model === 'account.reconcile.model' && args.method === 'search_read') {
|
||||
assert.deepEqual(
|
||||
args.kwargs.domain,
|
||||
[['company_id', 'in', [3,4]], ['match_journal_ids', 'in', [false, 1, 2]]],
|
||||
'The domain to get reconcile models should contain the right fields and values'
|
||||
);
|
||||
}
|
||||
return this._super.apply(this, arguments);
|
||||
}
|
||||
});
|
||||
clientAction.appendTo($('#qunit-fixture'));
|
||||
testUtilsMock.unpatch(this.params.options.context);
|
||||
|
||||
clientAction.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('Reconciliation manual', async function (assert) {
|
||||
assert.expect(13);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user