summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/fields/basic_fields_tests.js
diff options
context:
space:
mode:
authorLucas Perais (lpe) <lpe@odoo.com>2018-10-08 16:37:24 +0200
committerLucas Perais (lpe) <lpe@odoo.com>2018-10-09 14:16:56 +0200
commitcba5f7a98f3644694eadc51c76ba080724879b28 (patch)
tree7a76b8dd65a5bd2c2af0245f8533bc8e0b5a0b3f /addons/web/static/tests/fields/basic_fields_tests.js
parentf6ea6ce951c43fdc6c02b803dbcab0d03d8c51ef (diff)
[FIX] web: fetch dependency fields in x2many
Image field widget need the __last_update field alongside them for caching purposes, though that field should never be present explicitly in the views Before this commit, the dependencies of field widgets were not merged into the model's fields definition, creating a traceback when adding an image field widget into a x2many list After this commit, there is no traceback and the image field works properly closes #27545
Diffstat (limited to 'addons/web/static/tests/fields/basic_fields_tests.js')
-rw-r--r--addons/web/static/tests/fields/basic_fields_tests.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/fields/basic_fields_tests.js
index 4ef08c02999..98468872ab9 100644
--- a/addons/web/static/tests/fields/basic_fields_tests.js
+++ b/addons/web/static/tests/fields/basic_fields_tests.js
@@ -1852,6 +1852,40 @@ QUnit.module('basic_fields', {
form.destroy();
});
+ QUnit.test('image fields in x2many list are loaded correctly', function (assert) {
+ assert.expect(2);
+
+ this.data.partner_type.fields.image = {name: 'image', type: 'binary'};
+ this.data.partner_type.records[0].image = 'product_image';
+ this.data.partner.records[0].timmy = [12];
+
+ var form = createView({
+ View: FormView,
+ model: 'partner',
+ data: this.data,
+ arch: '<form string="Partners">' +
+ '<field name="timmy" widget="many2many">' +
+ '<tree>' +
+ '<field name="image" widget="image"/>' +
+ '</tree>' +
+ '</field>' +
+ '</form>',
+ res_id: 1,
+ mockRPC: function (route, args) {
+ if (route === 'data:image/png;base64,product_image') {
+ assert.ok(true, "The list's image should have been fetched");
+ return $.when();
+ }
+ return this._super.apply(this, arguments);
+ },
+ });
+
+ assert.strictEqual(form.$('tr.o_data_row').length, 1,
+ 'There should be one record in the many2many');
+
+ form.destroy();
+ });
+
QUnit.test('image fields with required attribute', function (assert) {
assert.expect(2);