diff options
| author | Elkasitu <adt@odoo.com> | 2017-07-25 10:28:18 +0200 |
|---|---|---|
| committer | Elkasitu <adt@odoo.com> | 2017-07-25 12:04:19 +0200 |
| commit | a4e30a1b43d0b9acd76508d9e6c466cd1dbdffab (patch) | |
| tree | 720cfabfcabfe4df23f6790531f88a5a782655fc /addons/web/static/tests | |
| parent | a41db9a2cf410bb233b021651a5633180eaddf18 (diff) | |
[FIX] web: prevent crash in FieldReference
Trying to display external identifiers would make the server crash
because the method in charge of requesting the external id information
would expect an object but it was being given a string and thus not
computing the m2o_value for the record.
This commit fixes this by changing FieldMany2One objects' m2o_value
instatiation to use its _formatValue method to compute it, _formatValue
is then overridden in FieldReference so that it properly handles both
strings and objects to calculate its m2o_value and relation.
Diffstat (limited to 'addons/web/static/tests')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index 30b6acc2c40..f3c63333f18 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -6921,7 +6921,7 @@ QUnit.module('relational_fields', { "should do a do_action with correct parameters"); }); - assert.strictEqual(form.$('a.o_form_uri:contains(xphone)').length, 1, + assert.strictEqual(form.$('a.o_form_uri:contains(first record)').length, 1, "should contain a link"); form.$('a.o_form_uri').click(); // click on the link in readonly mode (should trigger do_action) @@ -6933,7 +6933,7 @@ QUnit.module('relational_fields', { "should contain one many2one"); assert.strictEqual(form.$('.o_field_widget select').val(), "product", "widget should contain one select with the model"); - assert.strictEqual(form.$('.o_field_widget input').val(), "xphone", + assert.strictEqual(form.$('.o_field_widget input').val(), "first record", "widget should contain one input with the record"); var options = _.map(form.$('.o_field_widget select > option'), function (el) { @@ -6942,7 +6942,6 @@ QUnit.module('relational_fields', { assert.deepEqual(options, ['', 'product', 'partner_type', 'partner'], "the options should be correctly set"); - form.$('.o_external_button').click(); // click on the external button (should do an RPC) assert.strictEqual($('.modal .modal-title').text().trim(), 'Open: custom label', @@ -6959,7 +6958,7 @@ QUnit.module('relational_fields', { $dropdown.find('li:first()').click(); form.$buttons.find('.o_form_button_save').click(); - assert.strictEqual(form.$('a.o_form_uri:contains(gold)').length, 1, + assert.strictEqual(form.$('a.o_form_uri').length, 1, "should contain a link with the new value"); form.destroy(); |
