summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-03-25 10:05:27 +0000
committerChristophe Simonis <chs@odoo.com>2019-03-25 11:13:41 +0000
commit5df4746c9aa144e6e3fce44fea43dac1089a5c51 (patch)
treef4ce932a76563e26b8d131805d49b405fcf9ad8f /addons/web/static/tests/fields/relational_fields_tests.js
parent39e71353c5d58f7af6b3270911a24d98b73cad4e (diff)
parent230ad8c381e927025efabff0f5f8c2debc432249 (diff)
[MERGE] forward port branch saas-12.2 up to 230ad8c381e
closes odoo/odoo#32088 Signed-off-by: Christophe Simonis <chs@odoo.com>
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js37
1 files changed, 37 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 e8d89aaf00d..1641dfa0730 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -361,6 +361,43 @@ QUnit.module('relational_fields', {
form.destroy();
});
+ QUnit.test('embedded readonly one2many with handle widget', async function (assert) {
+ assert.expect(4);
+
+ this.data.partner.records[0].turtles = [1, 2, 3];
+
+ var form = await createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch:'<form string="Partners">' +
+ '<sheet>' +
+ '<field name="turtles" readonly="1">' +
+ '<tree editable="top">' +
+ '<field name="turtle_int" widget="handle"/>' +
+ '<field name="turtle_foo"/>' +
+ '</tree>' +
+ '</field>' +
+ '</sheet>' +
+ '</form>',
+ res_id: 1,
+ });
+
+ assert.strictEqual(form.$('.o_row_handle').length, 3,
+ "there should be 3 handles (one for each row)");
+ assert.strictEqual(form.$('.o_row_handle:visible').length, 0,
+ "the handles should be hidden in readonly mode");
+
+ await testUtils.form.clickEdit(form);
+
+ assert.strictEqual(form.$('.o_row_handle').length, 3,
+ "the handles should still be there");
+ assert.strictEqual(form.$('.o_row_handle:visible').length, 0,
+ "the handles should still be hidden (on readonly fields)");
+
+ form.destroy();
+ });
+
QUnit.test('delete a record while adding another one in a multipage', async function (assert) {
// in a many2one with at least 2 pages, add a new line. Delete the line above it.
// (the onchange makes it so that the virtualID is inserted in the middle of the currentResIDs.)