diff options
| author | Cedric Snauwaert <csn@openerp.com> | 2019-09-13 14:25:34 +0000 |
|---|---|---|
| committer | Cedric Snauwaert <csn@openerp.com> | 2019-09-16 14:36:02 +0000 |
| commit | 35cbb430ce79ce26d8cd1b7c2f9f112b35d1e6a1 (patch) | |
| tree | 2b8ae2fe4b46c3513c96416dd9b662397604caea | |
| parent | 545b00ee79348a7f88eb074435918911b840134e (diff) | |
[FIX] account: fix focus problem in manual reconciliation
Previously when opening the manual reconciliation widget with several lines, trying to put the focus on another line by clicking on the grey line was not working due to a o_field_widget with the partner name taking all the line and there is an event on that o_field_widget that stop the propagation of the event.
Also changing the partner value was only changing the value in the grey zone and not in the other field.
Therefore as it was strange to have twice the name of the partner display one above another and that it was causing problem for the focus of the widget. We removed the name of the partner that was readonly (leaving the editable field where we can change it) and we replaced it with the name of the account which makes more sense.
closes odoo/odoo#36881
Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com>
| -rw-r--r-- | addons/account/static/src/js/reconciliation/reconciliation_renderer.js | 47 | ||||
| -rw-r--r-- | addons/account/static/tests/reconciliation_tests.js | 4 |
2 files changed, 15 insertions, 36 deletions
diff --git a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js index 207a00e948e..a9d0c0d9566 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_renderer.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_renderer.js @@ -893,40 +893,19 @@ var ManualLineRenderer = LineRenderer.extend({ start: function () { var self = this; return this._super.apply(this, arguments).then(function () { - var defs = []; - var def; - if (self._initialState.partner_id) { - def = self._makePartnerRecord(self._initialState.partner_id, self._initialState.partner_name).then(function (recordID) { - self.fields.partner_id = new relational_fields.FieldMany2One(self, - 'partner_id', - self.model.get(recordID), - {mode: 'readonly'} - ); - }); - defs.push(def); - } else { - def = self.model.makeRecord('account.move.line', [{ - relation: 'account.account', - type: 'many2one', - name: 'account_id', - value: [self._initialState.account_id.id, self._initialState.account_id.display_name], - }]).then(function (recordID) { - self.fields.title_account_id = new relational_fields.FieldMany2One(self, - 'account_id', - self.model.get(recordID), - {mode: 'readonly'} - ); - }); - defs.push(def); - } - - return Promise.all(defs).then(function () { - if (!self.fields.title_account_id) { - return self.fields.partner_id.prependTo(self.$('.accounting_view thead td:eq(0) span:first')); - } else { - self.fields.partner_id.destroy(); - return self.fields.title_account_id.appendTo(self.$('.accounting_view thead td:eq(0) span:first')); - } + return self.model.makeRecord('account.move.line', [{ + relation: 'account.account', + type: 'many2one', + name: 'account_id', + value: [self._initialState.account_id.id, self._initialState.account_id.display_name], + }]).then(function (recordID) { + self.fields.title_account_id = new relational_fields.FieldMany2One(self, + 'account_id', + self.model.get(recordID), + {mode: 'readonly'} + ); + }).then(function () { + return self.fields.title_account_id.appendTo(self.$('.accounting_view thead td:eq(0) span:first')); }); }); }, diff --git a/addons/account/static/tests/reconciliation_tests.js b/addons/account/static/tests/reconciliation_tests.js index 8d3a0fe5a5a..216074a0073 100644 --- a/addons/account/static/tests/reconciliation_tests.js +++ b/addons/account/static/tests/reconciliation_tests.js @@ -1354,8 +1354,8 @@ QUnit.module('account', { await testUtils.dom.click(clientAction.$('.accounting_view:first .o_reconcile:visible')); assert.strictEqual(clientAction.$('.accounting_view:first thead').text().replace(/[\n\r\s]+/g, ' '), - " Agrolait 101200 ", - "should display the partner and the account code as title"); + " 101200 Account Receivable 101200 ", + "should display the account and the account code as title"); assert.strictEqual(clientAction.$('.o_reconciliation_line:first .match:first tr:first .cell_right').text().trim().replace(/[\n\r\s\u00a0]+/g, ' '), "$ 11,000.00", "sould display the line in $"); |
