diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-02-28 16:17:28 +0100 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2017-04-11 19:44:38 +0200 |
| commit | d7eb116fa8b9d5e9cd75f628a3a9e6e53fcbd744 (patch) | |
| tree | 99dfc85850cd72dfe627b3a9fe34818bd75c513f /addons/web/static/test | |
| parent | 7465798ccda4ff28c04283d295aae3fc49f2a46a (diff) | |
[FIX] web: properly compute contexts in some cases
When we have a many2one widget in a one2many, editable, the context was
not properly computed: it expected the parent to be a record object, but
in that case, it is a list object.
Diffstat (limited to 'addons/web/static/test')
| -rw-r--r-- | addons/web/static/test/fields/relational_fields_tests.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/addons/web/static/test/fields/relational_fields_tests.js b/addons/web/static/test/fields/relational_fields_tests.js index 294a3cb44d5..583f9adfdd1 100644 --- a/addons/web/static/test/fields/relational_fields_tests.js +++ b/addons/web/static/test/fields/relational_fields_tests.js @@ -1431,6 +1431,44 @@ QUnit.module('relational_fields', { form.destroy(); }); + QUnit.test('one2many list, editable, with many2one and with context with parent key', function (assert) { + assert.expect(1); + + this.data.partner.records[0].p = [2]; + this.data.partner.records[1].product_id = 37; + + var form = createView({ + View: FormView, + model: 'partner', + data: this.data, + arch: '<form string="Partners">' + + '<field name="foo"/>' + + '<field name="p">' + + '<tree editable="bottom">' + + '<field name="product_id" context="{\'partner_foo\':parent.foo}"/>' + + '</tree>' + + '</field>' + + '</form>', + res_id: 1, + mockRPC: function (route, args) { + if (args.method === 'name_search') { + assert.strictEqual(args.kwargs.context.partner_foo, "yop", + "should have correctly evaluated parent foo field"); + } + return this._super.apply(this, arguments); + }, + }); + + form.$buttons.find('.o_form_button_edit').click(); + + form.$('tr.o_data_row:eq(0) td:contains(xphone)').click(); + + // trigger a name search + form.$('table td input.o_form_input').click(); + + form.destroy(); + }); + QUnit.test('one2many list edition, some basic functionality', function (assert) { assert.expect(3); |
