summaryrefslogtreecommitdiff
path: root/addons/account/static/tests
diff options
context:
space:
mode:
authorwan <wan@odoo.com>2019-02-08 10:11:41 +0000
committerwan <wan@odoo.com>2019-02-08 10:11:41 +0000
commit969705fa2ae8bfd5e2d2cfce0241fcd56bebf01f (patch)
treeddfc35a278f022c3c62962a14b587de49bb67f4a /addons/account/static/tests
parent723789b6b1997568943bcf2fa879b8471838ec19 (diff)
[ADD] account: suspense account management
Task 1930403 Purpose: A suspense account is an account in the general ledger that temporarily stores any transactions for which there is uncertainty about the account in which they should be recorded. Once the accounting staff investigates and clarifies the purpose of this type of transaction, it shifts the transaction out of the suspense account and into the correct account(s). An entry into a suspense account may be a debit or a credit. The Chosen Odoo approach (macro) for this case is 1) from bank statement -> reconciliation widget -> reconciliation model 2) create move that have a dedicated checkbox 3) be able to reopen the bank statement line "like if there is no linked account move" and finally reconcile the transaction with the good invoice/bill (we can reprocess account move "to check") 4) when we reprocess, Instead of creating an account move : Check if there is an "to check" existing linked account move and remove all the account move lines then replace them by the good ones --> we want to keep the sequence closes odoo/odoo#30486
Diffstat (limited to 'addons/account/static/tests')
-rw-r--r--addons/account/static/tests/reconciliation_tests.js63
1 files changed, 62 insertions, 1 deletions
diff --git a/addons/account/static/tests/reconciliation_tests.js b/addons/account/static/tests/reconciliation_tests.js
index 8b48d52a723..d32d5a51233 100644
--- a/addons/account/static/tests/reconciliation_tests.js
+++ b/addons/account/static/tests/reconciliation_tests.js
@@ -63,6 +63,7 @@ var db = {
{id: 287, code: 101200, name: "101200 Account Receivable", company_id: 1},
{id: 288, code: 101300, name: "101300 Tax Paid", company_id: 1},
{id: 308, code: 101401, name: "101401 Bank", company_id: 1},
+ {id: 499, code: 499001, name: "499001 Suspense Account", company_id: 1},
{id: 500, code: 500, name: "500 Account", company_id: 1},
{id: 501, code: 501, name: "501 Account", company_id: 1},
{id: 502, code: 502, name: "502 Account", company_id: 1},
@@ -553,7 +554,7 @@ var session = {
var options = {
context: {
- statement_ids: [4]
+ statement_line_ids: [4]
},
params: {
limitMoveLines: 5,
@@ -1857,5 +1858,65 @@ QUnit.module('account', {
clientAction.destroy();
});
+
+ QUnit.test('Reconcile temporarily and ask to check', function(assert){
+ assert.expect(4);
+ this.params.options.context['to_check'] = true;
+ var clientAction = new ReconciliationClientAction.StatementAction(null, this.params.options);
+
+ testUtils.mock.addMockEnvironment(clientAction, {
+ data: this.params.data,
+ session: {
+ currencies: {
+ 3: {
+ digits: [69, 2],
+ position: "before",
+ symbol: "$"
+ }
+ }
+ },
+ });
+ clientAction.appendTo($('#qunit-fixture'));
+ var widget = clientAction.widgets[0];
+
+ // Add a line as proposition
+ // open the first line
+ widget.$('.accounting_view tfoot td.cell_label').click()
+
+ var $reconcileForm = widget.$(".create");
+ $reconcileForm.find('.create_account_id input').val('499001 Suspense Account').keydown().keyup()
+ $reconcileForm.find('.create_account_id input').click();
+ $('.ui-autocomplete .ui-menu-item a:contains(499001 Suspense Account)')
+ .trigger('mouseover')
+ .trigger('click');
+
+ assert.equal($("button.o_validate.btn.btn-secondary.text-warning:first").length, 0, "should not display reconcile button in orange");
+ $reconcileForm.find('.create_to_check input').click()
+ assert.equal($("button.o_validate.btn.btn-secondary.text-warning:first").length, 1, "should display reconcile button in orange");
+
+ testUtils.mock.intercept(clientAction, 'call_service', function (event) {
+ assert.deepEqual(event.data.args[1].args,
+ [[5],[{partner_id: 8,
+ counterpart_aml_dicts: [],
+ payment_aml_ids: [],
+ new_aml_dicts: [{account_id: 499,
+ credit: 1175,
+ debit: 0,
+ analytic_tag_ids: [[6, null, []]],
+ name: 'SAJ/2014/002 and SAJ/2014/003',
+ }],
+ to_check: true,
+ }]],
+ "Should call process_bank_statement_line with to_check set to true");
+ var def = $.Deferred();
+ def.abort = function () {};
+ event.data.callback(def);
+ });
+
+ widget.$("button.o_reconcile.btn.btn-primary:first").click();
+ assert.ok(true, "No error in reconciliation");
+
+ clientAction.destroy();
+ });
});
});