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 $");