[FIX] account: add missing class on section and note field

after the update of jquery, all promises are asynchronous.
In the invoices, a class was added to the section and note field before
it was rendered.

To fix this, we are now waiting for the rendering to be completed before
adding the class.

closes odoo/odoo#31666

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Vincent Schippefilt
2019-03-07 14:50:31 +00:00
parent 1d3af8e957
commit 7221aa7db4
2 changed files with 7 additions and 4 deletions
@@ -68,9 +68,10 @@ var SectionAndNoteListRenderer = ListRenderer.extend({
* @private
*/
_renderView: function () {
var def = this._super();
this.$el.find('> table').addClass('o_section_and_note_list_view');
return def;
var self = this;
return this._super.apply(this, arguments).then(function () {
self.$('> table').addClass('o_section_and_note_list_view');
});
},
/**
* Add support for product configurator
@@ -47,7 +47,7 @@ QUnit.module('section_and_note', {
},
}, function () {
QUnit.test('correct display of section and note fields', async function (assert) {
assert.expect(4);
assert.expect(5);
var form = await createView({
View: FormView,
model: 'invoice',
@@ -64,6 +64,8 @@ QUnit.module('section_and_note', {
res_id: 1,
});
assert.hasClass(form.$('[name="invoice_line_ids"] table'), 'o_section_and_note_list_view');
// section should be displayed correctly
var $tr0 = form.$('tr.o_data_row:eq(0)');