summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/relational_fields_tests.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-06-15 12:37:42 +0200
committerAaron Bohy <aab@odoo.com>2017-06-16 11:14:16 +0200
commit8859d25bc5b719734b7d02bc26adfd38dca79e56 (patch)
tree6106160ae2da305999149bbc141950442d802e26 /addons/web/static/tests/fields/relational_fields_tests.js
parent1fa67917ba648bc15f5a895f6bdcea173e2a7258 (diff)
[FIX] web: FieldWidgets: use correct format/parse functions
Field widgets must format and parse values according to the widget type, not to the field type. For example, if a monetary field is inserted in a form view with widget="float", the field's value must be formatted with the float formatter, not the montetary one. This wasn't the case before this rev.
Diffstat (limited to 'addons/web/static/tests/fields/relational_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/relational_fields_tests.js9
1 files changed, 8 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 a1f851eb91f..9155cf02951 100644
--- a/addons/web/static/tests/fields/relational_fields_tests.js
+++ b/addons/web/static/tests/fields/relational_fields_tests.js
@@ -5153,7 +5153,7 @@ QUnit.module('relational_fields', {
});
QUnit.test('widget selection, edition and on many2one field', function (assert) {
- assert.expect(15);
+ assert.expect(18);
this.data.partner.onchanges = {product_id: function () {}};
this.data.partner.records[0].product_id = 37;
@@ -5178,6 +5178,13 @@ QUnit.module('relational_fields', {
});
assert.ok(!form.$('select').length, "should not have a select tag in dom");
+ assert.strictEqual(form.$('.o_field_widget[name=product_id]').text(), 'xphone',
+ "should have rendered the many2one field correctly");
+ assert.strictEqual(form.$('.o_field_widget[name=trululu]').text(), '',
+ "should have rendered the unset many2one field correctly");
+ assert.strictEqual(form.$('.o_field_widget[name=color]').text(), 'Red',
+ "should have rendered the selection field correctly");
+
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(form.$('select').length, 3,