diff options
| author | Aaron Bohy <aab@odoo.com> | 2017-08-28 16:14:31 +0200 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-08-29 10:38:36 +0200 |
| commit | d93726f9ac6d64a39cd95f35cf61a898e4cd2009 (patch) | |
| tree | ecba41a9f85a4368f3675f9710a9cf893c151ea0 /addons/web/static/tests/fields | |
| parent | f24c83efcc47b24ac8fc7a8add8d2ce39a89ebdf (diff) | |
[FIX] web,mail: only send fields in view for onchanges
The field 'display_name' is automatically added to the list of
fields to fetch when fetching a record. Before this rev., its
value was also sent alongside the fields in the view for onchange
RPCs. It shouldn't: only the fields in the view should be sent.
It produced a weird bug in the res.partner form view: open a
contact (company), add a sub-contact, save -> the display_name of
the contact was then '' (and 'Contacts' was displayed in the
breadcrumbs instead of the display_name of the opened contact).
This is because 'display_name' was sent to the onchange, which
returned '' as value (because of another bug python side). So as
it's value changed, when saving, the new display_name was sent to
the server (even if this field was actually readonly).
Before this rev., we also always fetched 'display_name' when
fetching list of records (read or search_read). This wasn't a bug
per se, but it might be a computed field, and it isn't necessary,
so we stop fetching it in that case if it isn't in the view (as
it was done in saas-15, before the new views).
Diffstat (limited to 'addons/web/static/tests/fields')
| -rw-r--r-- | addons/web/static/tests/fields/relational_fields_tests.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/fields/relational_fields_tests.js index a2504af38bb..92a24066408 100644 --- a/addons/web/static/tests/fields/relational_fields_tests.js +++ b/addons/web/static/tests/fields/relational_fields_tests.js @@ -2521,6 +2521,7 @@ QUnit.module('relational_fields', { arch:'<form string="Partners">' + '<field name="p">' + '<kanban create="0">' + + '<field name="display_name"/>' + '<templates>' + '<t t-name="kanban-box">' + '<div class="oe_kanban_global_click">' + @@ -3499,7 +3500,7 @@ QUnit.module('relational_fields', { rpcCount++; if (args.method === 'write') { assert.deepEqual(args.args[1].p, [[0, false, { - display_name: false, int_field: 123, product_id: 41 + int_field: 123, product_id: 41 }]]); } return this._super(route, args); @@ -3736,7 +3737,7 @@ QUnit.module('relational_fields', { if (args.method === 'default_get') { var expected = counter === 0 ? [[4, 2, false]] : - [[4, 2, false], [0, false, {display_name: false, turtle_foo: 'hammer'}]]; + [[4, 2, false], [0, false, {turtle_foo: 'hammer'}]]; assert.deepEqual(args.kwargs.context.turtles, expected, "should have properly evaluated turtles key in context"); counter++; @@ -5544,6 +5545,7 @@ QUnit.module('relational_fields', { arch:'<form string="Partners">' + '<field name="timmy">' + '<kanban create="0">' + + '<field name="display_name"/>' + '<templates>' + '<t t-name="kanban-box">' + '<div class="oe_kanban_global_click">' + |
