[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>
This commit is contained in:
@@ -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'));
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
@@ -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 $");
|
||||
|
||||
Reference in New Issue
Block a user