From da136d83bb4cd952dc0e2417d67679cfc5068f34 Mon Sep 17 00:00:00 2001 From: fwi-odoo Date: Fri, 15 Sep 2017 10:19:16 +0200 Subject: [IMP] web: x2m list: conditionnaly hide a column This commit introduces a new way to hide a column in a x2m list view. The attribute 'tree_invisible' can be add in the field attrs in the x2m view definition. This attribute can use the 'parent' key to make a reference to the parent record (e.g. 'parent.id'). --- .../static/tests/fields/relational_fields_tests.js | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'addons/web/static/tests/fields/relational_fields_tests.js') diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index c5b4001e087..8cf0e20037e 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -8351,6 +8351,40 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('one2many invisible depends on parent field', function (assert) { + assert.expect(2); + + this.data.partner.records[0].p = [2]; + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch:'
' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
', + res_id: 1, + }); + assert.strictEqual(form.$('th').length, 2, + "should be 2 columns in the one2many"); + form.$buttons.find('.o_form_button_edit').click(); + form.$('.o_field_boolean[name="bar"] input').click(); + assert.strictEqual(form.$('th').length, 1, + "should be 1 column after the value change"); + form.destroy(); + }); + }); }); }); -- cgit v1.2.3