diff options
| author | Martin Geubelle <mge@odoo.com> | 2018-05-28 18:26:22 +0200 |
|---|---|---|
| committer | Martin Geubelle <mge@odoo.com> | 2018-05-29 15:55:05 +0200 |
| commit | 66ccc6503d3b02653f4631d08bc55d875a35501d (patch) | |
| tree | 1d55855ece869ffcfb6a77b52b163438c007779a /addons/web/static/tests | |
| parent | ecbafe92d22a2615f4ffa0a397a41548c0d59be4 (diff) | |
[IMP] web: correctly handle attributes on non inline view
Before this rev. the `column_invisible` and `default_order` attribute, set in a
x2m list view were only taken into account for inline views.
The technical reason behind is because non inline views are fetched after the
main view processing.
Non inline x2m list views now correctly handle these two attributes.
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index d5b23955bde..b16d812993e 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -2595,6 +2595,36 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('one2many with default_order on view not inline', function (assert) { + assert.expect(1); + + this.data.partner.records[0].turtles = [1,2,3]; + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'<form string="Partners">' + + '<sheet>' + + '<notebook>' + + '<page string="Turtles">' + + '<field name="turtles"/>' + + '</page>' + + '</notebook>' + + '</sheet>' + + '</form>', + archs: { + 'turtle,false,list': '<tree default_order="turtle_foo">' + + '<field name="turtle_int"/>' + + '<field name="turtle_foo"/>' + + '</tree>', + }, + res_id: 1, + }); + assert.strictEqual(form.$('.o_field_one2many .o_list_view .o_data_row').text(), "9blip21kawa0yop", + "the default order should be correctly applied"); + form.destroy(); + }); + QUnit.test('embedded one2many with widget', function (assert) { assert.expect(1); @@ -11623,6 +11653,51 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('one2many column_invisible on view not inline', function (assert) { + assert.expect(4); + + this.data.partner.records[0].p = [2]; + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'<form string="Partners">' + + '<sheet>' + + '<group>' + + '<field name="product_id"/>' + + '</group>' + + '<notebook>' + + '<page string="Partner page">' + + '<field name="bar"/>' + + '<field name="p"/>' + + '</page>' + + '</notebook>' + + '</sheet>' + + '</form>', + res_id: 1, + archs: { + 'partner,false,list': '<tree>' + + '<field name="foo" attrs="{\'column_invisible\': [(\'parent.product_id\', \'!=\', False)]}"/>' + + '<field name="bar" attrs="{\'column_invisible\': [(\'parent.bar\', \'=\', False)]}"/>' + + '</tree>', + }, + }); + assert.strictEqual(form.$('th').length, 2, + "should be 2 columns in the one2many"); + form.$buttons.find('.o_form_button_edit').click(); + form.$('.o_field_many2one[name="product_id"] input').click(); + $('li.ui-menu-item a:contains(xpad)').trigger('mouseenter').click(); + assert.strictEqual(form.$('th').length, 1, + "should be 1 column when the product_id is set"); + form.$('.o_field_many2one[name="product_id"] input').val('').trigger('keyup'); + assert.strictEqual(form.$('th').length, 2, + "should be 2 columns in the one2many when product_id is not set"); + form.$('.o_field_boolean[name="bar"] input').click(); + assert.strictEqual(form.$('th').length, 1, + "should be 1 column after the value change"); + form.destroy(); + }); + QUnit.module('TabNavigation'); QUnit.test('when Navigating to a many to one with tabs, it receives the focus on the add new line link', function (assert) { |
