summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-05-02 19:36:16 +0200
committerChristophe Simonis <chs@odoo.com>2018-05-02 19:36:16 +0200
commit87e21ccdc5c181960fa0d137e3ed880673032ca9 (patch)
tree5aa3efc5a04796733c242129d91343149839abcb /addons/web/static/tests/fields/relational_fields_tests.js
parent3596e67afb72aac22d9a71ddf542cc5bbe00bce0 (diff)
parent521414b1c106187ceac972ba7ae6f5c342959940 (diff)
[MERGE] forward port branch 11.0 up to 521414b1c10
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js46
1 files changed, 45 insertions, 1 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js
index 29d3dad6056..1c050edf3f4 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -2331,6 +2331,50 @@ QUnit.module('relational_fields', {
QUnit.module('FieldOne2Many');
+ QUnit.test('one2many with two inline views', function (assert) {
+ assert.expect(1);
+
+ // The inline list view has and uses a field that the inline form view doesn't have
+ // We need to test that returning from the form view to the list view unfolds smoothly
+ // Even if a field needed in the list is not set in the form
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch: '<form string="Partners">' +
+ '<field name="turtles">' +
+ '<tree>' +
+ '<field name="turtle_foo"/>' +
+ '<field name="display_name" attrs="{\'readonly\': [(\'turtle_foo\', \'=\', \'lol\')]}"/>' +
+ '</tree>' +
+ '<form>' +
+ '<field name="display_name"/>' +
+ '</form>' +
+ '</field>' +
+ '</form>',
+ res_id: 1,
+ viewOptions: {
+ mode: 'edit',
+ },
+ });
+
+ // Add a record with the form view
+ form.$('.o_field_x2many_list .o_field_x2many_list_row_add a').click();
+ var modal = $('.modal-dialog');
+ // Fill in the only field
+ modal.find('input[name=display_name]').val('lol').trigger('input');
+ // Save the record
+ modal.find('.btn-primary').first().click();
+
+ // Now back to the list, verifying that the record is present
+ var $newRecord = form.$('.o_field_x2many_list tbody .o_data_row').eq(1);
+ assert.equal($newRecord.find('.o_data_cell').eq(1).text(), 'lol',
+ 'We should have created a record in the One2Many');
+
+ form.destroy();
+ });
+
QUnit.test('one2many list editable with cell readonly modifier', function (assert) {
assert.expect(4);
@@ -5699,7 +5743,7 @@ QUnit.module('relational_fields', {
rpcCount++;
if (args.method === 'write') {
assert.deepEqual(args.args[1].p, [[0, args.args[1].p[0][1], {
- int_field: 123, product_id: 41
+ int_field: 123, product_id: 41, foo: false,
}]]);
}
return this._super(route, args);