summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/basic_model_tests.js
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2017-04-20 13:56:53 +0200
committerAaron Bohy <aab@odoo.com>2017-04-20 13:56:53 +0200
commit78709e6b14bf977162ac3c324dbb26596495f7d8 (patch)
tree5f3d529644fd76d639b98c1962e89af57ccdd74e /addons/web/static/tests/views/basic_model_tests.js
parent51beb6a0adbdfbf7da44e94cb1e2b5045d09d84f (diff)
[FIX] web: BasicModel: context when creating a record
Before this rev., the context sent when creating (or saving) a record was incomplete. Thus, the created record might be incorrect. For example, go to Sales, open a team's pipeline, click on 'Create'. The created record should belong to the selected team, thanks to some keys specified in the context. This wasn't the case before this rev.
Diffstat (limited to 'addons/web/static/tests/views/basic_model_tests.js')
-rw-r--r--addons/web/static/tests/views/basic_model_tests.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/tests/views/basic_model_tests.js b/addons/web/static/tests/views/basic_model_tests.js
index cd290dd0a13..ac703c0d90b 100644
--- a/addons/web/static/tests/views/basic_model_tests.js
+++ b/addons/web/static/tests/views/basic_model_tests.js
@@ -716,11 +716,12 @@ QUnit.module('Views', {
});
QUnit.test('create record, then save', function (assert) {
- assert.expect(4);
+ assert.expect(5);
this.params.fieldNames = ['product_ids'];
this.params.res_id = undefined;
this.params.type = 'record';
+ this.params.context = {active_field: 2};
var id;
var model = createModel({
@@ -731,6 +732,9 @@ QUnit.module('Views', {
// has to be done before the call to _super
assert.notOk('product_ids' in args.args[0], "should not have any value");
assert.notOk('category' in args.args[0], "should not have other fields");
+
+ assert.strictEqual(args.kwargs.context.active_field, 2,
+ "record's context should be correctly passed");
}
var result = this._super(route, args);
if (args.method === 'create') {