diff options
Diffstat (limited to 'addons/account/static/src')
5 files changed, 164 insertions, 177 deletions
diff --git a/addons/account/static/src/js/reconciliation/reconciliation_action.js b/addons/account/static/src/js/reconciliation/reconciliation_action.js index 4102780c5c0..b047ed8cdaf 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_action.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_action.js @@ -57,7 +57,7 @@ var StatementAction = Widget.extend(ControlPanelMixin, { this.action_manager = parent; this.params = params; this.model = new this.config.Model(this, { - modelName: "account.bank.statement.line", + modelName: "account.reconciliation.widget", limitMoveLines: params.params && params.params.limitMoveLines || this.config.limitMoveLines, }); this.widgets = []; diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index 9894dc6a9b4..570e111cbe6 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -11,8 +11,8 @@ var _t = core._t; /** - * Model use to fetch, format and update 'account.bank.statement' and - * 'account.bank.statement.line' datas allowing reconciliation + * Model use to fetch, format and update 'account.reconciliation.widget', + * datas allowing reconciliation * * The statement internal structure:: * @@ -133,8 +133,8 @@ var StatementModel = BasicModel.extend({ return $.when(this._computeLine(line), this._performMoveLine(handle)); }, /** - * send information 'account.bank.statement.line' model to reconciliate - * lines, call rpc to 'reconciliation_widget_auto_reconcile' + * send information 'account.reconciliation.widget' model to reconciliate + * lines, call rpc to 'auto_reconcile' * Update the number of validated line * * @returns {Deferred<Object>} resolved with an object who contains @@ -144,8 +144,8 @@ var StatementModel = BasicModel.extend({ var self = this; var ids = _.pluck(_.filter(this.lines, {'reconciled': false}), 'id'); return this._rpc({ - model: 'account.bank.statement.line', - method: 'reconciliation_widget_auto_reconcile', + model: 'account.reconciliation.widget', + method: 'auto_reconcile', args: [ids, self.valuenow], }) .then(function (result) { @@ -342,7 +342,7 @@ var StatementModel = BasicModel.extend({ * - 'account.bank.statement' fetch the line id and bank_statement_id info * - 'account.reconcile.model' fetch all reconcile model (for quick add) * - 'account.account' fetch all account code - * - 'account.bank.statement.line' fetch each line data + * - 'account.reconciliation.widget' fetch each line data * * @param {Object} context * @param {number[]} context.statement_ids @@ -357,8 +357,8 @@ var StatementModel = BasicModel.extend({ this.context = context; var def_statement = this._rpc({ - model: 'account.bank.statement', - method: 'reconciliation_widget_preprocess', + model: 'account.reconciliation.widget', + method: 'get_bank_statement_data', args: [statement_ids], }) .then(function (statement) { @@ -430,8 +430,8 @@ var StatementModel = BasicModel.extend({ loadData: function(ids, excluded_ids) { var self = this; return self._rpc({ - model: 'account.bank.statement.line', - method: 'get_data_for_reconciliation_widget', + model: 'account.reconciliation.widget', + method: 'get_bank_statement_line_data', args: [ids, excluded_ids], }) .then(self._formatLine.bind(self)); @@ -619,7 +619,7 @@ var StatementModel = BasicModel.extend({ return this._computeLine(line); }, /** - * Format the value and send it to 'account.bank.statement.line' model + * Format the value and send it to 'account.reconciliation.widget' model * Update the number of validated lines * * @param {(string|string[])} handle @@ -688,8 +688,8 @@ var StatementModel = BasicModel.extend({ }); return this._rpc({ - model: 'account.bank.statement.line', - method: 'process_reconciliations', + model: 'account.reconciliation.widget', + method: 'process_bank_statement_line', args: [ids, values], }) .then(function () { @@ -1062,7 +1062,7 @@ var StatementModel = BasicModel.extend({ return !isNaN(prop.id) || prop.account_id && prop.amount && prop.label && !!prop.label.length; }, /** - * Fetch 'account.bank.statement.line' propositions. + * Fetch 'account.reconciliation.widget' propositions. * * @see '_formatMoveLine' * @@ -1081,8 +1081,8 @@ var StatementModel = BasicModel.extend({ var offset = line.offset; var limit = this.limitMoveLines+1; return this._rpc({ - model: 'account.bank.statement.line', - method: 'get_move_lines_for_reconciliation_widget', + model: 'account.reconciliation.widget', + method: 'get_move_lines_for_bank_statement_line', args: [line.id, line.st_line.partner_id, excluded_ids, filter, offset, limit], }) .then(this._formatMoveLine.bind(this, handle)); @@ -1141,7 +1141,7 @@ var ManualModel = StatementModel.extend({ /** * load data from - * - 'account.move.line' fetch the lines to reconciliate + * - 'account.reconciliation.widget' fetch the lines to reconciliate * - 'account.account' fetch all account code * * @param {Object} context @@ -1177,7 +1177,7 @@ var ManualModel = StatementModel.extend({ var mode = context.mode === 'customers' ? 'receivable' : 'payable'; var args = ['partner', context.partner_ids || null, mode]; return self._rpc({ - model: 'account.move.line', + model: 'account.reconciliation.widget', method: 'get_data_for_manual_reconciliation', args: args, context: context, @@ -1190,7 +1190,7 @@ var ManualModel = StatementModel.extend({ }); case 'accounts': return self._rpc({ - model: 'account.move.line', + model: 'account.reconciliation.widget', method: 'get_data_for_manual_reconciliation', args: ['account', context.account_ids || self.account_ids], context: context, @@ -1209,8 +1209,8 @@ var ManualModel = StatementModel.extend({ account_ids = null; // TOFIX: REMOVE ME partner_ids = null; // TOFIX: REMOVE ME return self._rpc({ - model: 'account.move.line', - method: 'get_data_for_manual_reconciliation_widget', + model: 'account.reconciliation.widget', + method: 'get_all_data_for_manual_reconciliation', args: [partner_ids, account_ids], context: context, }) @@ -1278,8 +1278,8 @@ var ManualModel = StatementModel.extend({ if (process_reconciliations.length) { def = self._rpc({ - model: 'account.move.line', - method: 'process_reconciliations', + model: 'account.reconciliation.widget', + method: 'process_move_lines', args: [process_reconciliations], }); } @@ -1440,7 +1440,7 @@ var ManualModel = StatementModel.extend({ var limit = this.limitMoveLines+1; var args = [line.account_id.id, line.partner_id, excluded_ids, filter, offset, limit]; return this._rpc({ - model: 'account.move.line', + model: 'account.reconciliation.widget', method: 'get_move_lines_for_manual_reconciliation', args: args, }) diff --git a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js index 189304b6747..d68d4e9d693 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js @@ -637,6 +637,7 @@ var LineRenderer = Widget.extend(FieldManagerMixin, { }, /** * @private + * @param {input event} event */ _onFilterChange: function (event) { this.trigger_up('change_filter', {'data': _.str.strip($(event.target).val())}); @@ -688,7 +689,7 @@ var LineRenderer = Widget.extend(FieldManagerMixin, { * @param {MouseEvent} event */ _onSelectMoveLine: function (event) { - var $el = $(event.target) + var $el = $(event.target); this._destroyPopover($el); var moveLineId = $el.closest('.mv_line').data('line-id'); this.trigger_up('add_proposition', {'data': moveLineId}); @@ -698,7 +699,7 @@ var LineRenderer = Widget.extend(FieldManagerMixin, { * @param {MouseEvent} event */ _onSelectProposition: function (event) { - var $el = $(event.target) + var $el = $(event.target); this._destroyPopover($el); var moveLineId = $el.closest('.mv_line').data('line-id'); this.trigger_up('remove_proposition', {'data': moveLineId}); diff --git a/addons/account/static/src/js/reconciliation/tour_reconciliation.js b/addons/account/static/src/js/reconciliation/tour_reconciliation.js new file mode 100644 index 00000000000..76a5bfdc65b --- /dev/null +++ b/addons/account/static/src/js/reconciliation/tour_reconciliation.js @@ -0,0 +1,135 @@ +odoo.define('account.tour_bank_statement_reconciliation', function(require) { +'use strict'; + +var core = require('web.core'); +var rpc = require('web.rpc'); +var Tour = require('web_tour.tour'); + +Tour.register('bank_statement_reconciliation', { + test: true, + // Go to the reconciliation page of the statement: "BNK/2014/001" + }, [ + { + content: "wait web client", + extra_trigger: 'body:not(:has(.o_reconciliation))', + trigger: '.o_web_client', + run: function () { + console.log("looking for 'bank_statement_reconciliation' url"); + rpc.query({ + model: 'account.bank.statement', + method: 'search', + args: [[['name', '=', 'BNK/2014/001']]], // account in l10n_generic_coa + }).then(function(ids) { + var path = "/web#statement_ids=" + ids[0] + "&action=bank_statement_reconciliation_view"; + console.log("'bank_statement_reconciliation' url is: '" + path + "'"); + window.location.href = path; + }).fail(function () { + throw new Error("'account.bank.statement' named 'BNK/2014/001' not found"); + }); + }, + timeout: 5000 + }, + { + content: "wait reconciliation page", + trigger: '.o_reconciliation', + run: function () {}, + }, + + // open a line and reconcile a line proposed by the server + + { + content: "open the last line in match mode to test the reconcile button", + extra_trigger: '.o_reconciliation_line:last .o_reconcile:visible', + trigger: '.o_reconciliation_line:last .accounting_view thead .cell_label:contains("/002")', + }, + { + content: "deselect the proposed line", + extra_trigger: '.o_reconciliation_line:last[data-mode="match"]', + trigger: '.o_reconciliation_line:last .accounting_view .cell_label:contains("/0002")' + }, + { + content: "re-select the line", + extra_trigger: '.o_reconciliation_line:last .o_no_valid:visible', // the user can't validate the line and display the write-off line + trigger: '.o_reconciliation_line:last .match .cell_label:contains("/0002")' + }, + { + content: "reconcile the line", + trigger: '.o_reconciliation_line:last .o_reconcile:visible', + }, + + // Make a partial reconciliation + + { + content: "open the last line in match mode to test the partial reconciliation", + extra_trigger: '.o_reconciliation_line:first[data-mode="match"]', + trigger: '.o_reconciliation_line:last .cell_label:contains("First")' + }, + { + content: "select a line with with a higher amount", + trigger: '.o_reconciliation_line:last .match .cell_right:contains($ 4,610.00)' + }, + { + content: "click on partial reconcile", + trigger: '.o_reconciliation_line:last .accounting_view .do_partial_reconcile_true' + }, + { + content: "reconcile the line", + trigger: '.o_reconciliation_line:last .o_reconcile:visible', + }, + + // Test changing the partner + + { + content: "change the partner of the second line", + trigger: '.o_reconciliation_line:nth-child(2) .o_field_many2one input', + run: 'text Agro' + }, + { + content: "select Agrolait", + extra_trigger: '.ui-autocomplete:visible li:eq(1):contains(Create "Agro")', + trigger: '.ui-autocomplete:visible li:contains(Agrolait)', + }, + { + content: "use filter", + extra_trigger: '.o_reconciliation_line:nth-child(2) .match:not(:has(tr:eq(2))) tr:eq(1)', + trigger: '.o_reconciliation_line:nth-child(2) .match .match_controls .filter', + run: 'text 4610' + }, + { + content: "select a line linked to Agrolait", + extra_trigger: '.o_reconciliation_line:nth-child(2) .match:not(:has(tr:eq(1)))', + trigger: '.o_reconciliation_line:nth-child(2) .match .line_info_button[data-content*=Agrolait]' + }, + { + content: "deselect the line", + trigger: '.o_reconciliation_line:nth-child(2) .accounting_view tbody .cell_label:first' + }, + { + content: "create a write-off", + extra_trigger: '.o_reconciliation_line:nth-child(2) .accounting_view tbody:not(:has(.cell_label))', + trigger: '.o_reconciliation_line:nth-child(2) .accounting_view tfoot .cell_label' + }, + { + content: "enter an account", + trigger: '.o_reconciliation_line:nth-child(2) .o_field_many2one[name="account_id"] input', + run: 'text 100000' + }, + { + content: "select the first account", + extra_trigger: '.ui-autocomplete:visible li:eq(1):contains(Create "100000")', + trigger: '.ui-autocomplete:visible li:contains(100000)', + }, + { + content: "reconcile the line with the write-off", + trigger: '.o_reconciliation_line:nth-child(2) .o_reconcile:visible', + }, + + // Be done + { + content: "check the number off validate lines", + trigger: '.o_reconciliation .progress-text:contains(3 / 5)' + }, + ] +); + +}); diff --git a/addons/account/static/src/js/tour_bank_statement_reconciliation.js b/addons/account/static/src/js/tour_bank_statement_reconciliation.js deleted file mode 100644 index b56b8747f1f..00000000000 --- a/addons/account/static/src/js/tour_bank_statement_reconciliation.js +++ /dev/null @@ -1,149 +0,0 @@ -odoo.define('account.tour_bank_statement_reconciliation', function(require) { -'use strict'; - -var core = require('web.core'); -var Tour = require('web.Tour'); - -var _t = core._t; - -Tour.register({ - id: 'bank_statement_reconciliation', - name: _t("Reconcile the demo bank statement"), - path: '/web', - mode: 'test', - steps: [ - // Go to the first statement reconciliation - { - title: "go to accounting", - element: '.oe_menu_toggler:contains("Accounting"):visible', - }, - { - title: "go to bank statements", - element: '.oe_menu_leaf:contains("Bank Statement"):visible', - }, - { - title: "select first bank statement", - element: '.oe_list_content tbody tr:contains("BNK/2014/001")', - }, - { - title: "click the reconcile button", - element: '.oe_form_container header button:contains("Reconcile")', - }, - - - // Check mutual exclusion of move lines - { - title: "set second reconciliation in match mode", - element: '.oe_bank_statement_reconciliation_line:nth-child(2) .initial_line' - }, - { - title: "deselect SAJ/2014/002 from second reconciliation", - element: '.oe_bank_statement_reconciliation_line:nth-child(2) .accounting_view .mv_line:contains("SAJ/2014/002")' - }, - { - title: "check it appeared in first reconciliation's matches list and select SAJ/2014/002 in second reconciliation", - waitNot: '.oe_bank_statement_reconciliation_line:nth-child(2) .accounting_view .mv_line:contains("SAJ/2014/002")', - waitFor: '.oe_bank_statement_reconciliation_line:first-child .mv_line:contains("SAJ/2014/002")', - element: '.oe_bank_statement_reconciliation_line:nth-child(2) .mv_line:contains("SAJ/2014/002")' - }, - - - // Make a partial reconciliation - { - title: "select SAJ/2014/001", - element: '.oe_bank_statement_reconciliation_line:first-child .mv_line:contains("SAJ/2014/001")' - }, - { - title: "click on the partial reconciliation button", - element: '.oe_bank_statement_reconciliation_line:first-child .mv_line:contains("SAJ/2014/001") .do_partial_reconcile_button' - }, - { - title: "click on the OK button", - element: '.oe_bank_statement_reconciliation_line:first-child .button_ok.oe_highlight' - }, - - - // Test changing the partner - { - title: "change the partner (1)", - waitNot: '.oe_bank_statement_reconciliation_line:nth-child(4)', // wait for the reconciliation to be processed - element: '.oe_bank_statement_reconciliation_line:first-child .partner_name' - }, - { - title: "change the partner (2)", - element: '.oe_bank_statement_reconciliation_line:first-child .change_partner_container input', - sampleText: 'Vauxoo', - }, - { - title: "change the partner (3)", - element: '.ui-autocomplete .ui-menu-item:contains("Vauxoo")' - }, - { - title: "check the reconciliation is reloaded and has no match", - element: '.oe_bank_statement_reconciliation_line:first-child.no_match', - }, - { - title: "change the partner back (1)", - element: '.oe_bank_statement_reconciliation_line:first-child .partner_name' - }, - { - title: "change the partner back (2)", - element: '.oe_bank_statement_reconciliation_line:first-child .change_partner_container input', - sampleText: 'Best Designers', - }, - { - title: "change the partner back (3)", - element: '.ui-autocomplete .ui-menu-item:contains("Best Designers")' - }, - { - title: "select SAJ/2014/002", - element: '.oe_bank_statement_reconciliation_line:first-child .mv_line:contains("SAJ/2014/002")' - }, - { - title: "click on the OK button", - element: '.oe_bank_statement_reconciliation_line:first-child .button_ok.oe_highlight' - }, - - - // Create a new move line in first reconciliation and validate it - { - title: "check following reconciliation passes in mode create", - waitNot: '.oe_bank_statement_reconciliation_line:nth-child(3)', // wait for the reconciliation to be processed - element: '.oe_bank_statement_reconciliation_line:first-child[data-mode="create"]' - }, - { - title: "click the Profit/Loss preset", - element: '.oe_bank_statement_reconciliation_line:first-child button:contains("Profit / Loss")' - }, - { - title: "click on the OK button", - element: '.oe_bank_statement_reconciliation_line:first-child .button_ok.oe_highlight' - }, - - - // Leave an open balance - { - title: "select SAJ/2014/003", - waitNot: '.oe_bank_statement_reconciliation_line:nth-child(2)', // wait for the reconciliation to be processed - element: '.oe_bank_statement_reconciliation_line:first-child .mv_line:contains("SAJ/2014/003")' - }, - { - title: "click on the Keep Open button", - element: '.oe_bank_statement_reconciliation_line:first-child .button_ok:not(.oe_highlight)' - }, - - - // Be done - { - title: "check 'finish screen' and close the statement", - waitFor: '.done_message', - element: '.button_close_statement' - }, - { - title: "check the statement is closed", - element: '.oe_form_container header .label:contains("Closed")' - }, - ] -}); - -}); |
