summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/views/basic_model_tests.js
diff options
context:
space:
mode:
authorJérémy Hennecart <jeh@odoo.com>2020-06-19 07:06:31 +0000
committerAaron Bohy <aab@odoo.com>2020-06-22 13:04:01 +0000
commitc7964657ecbbad278cec73cf231d7eef55b44347 (patch)
treebe77532a80cbed1283c2062cb2dc1159aa0fbdd4 /addons/web/static/tests/views/basic_model_tests.js
parent96fcefb6f1fe3fb5a5f197e2635e6d71d9a1d9dd (diff)
[IMP] web: add support of "sample" attribute in views
With this commit, it is now possible to display sample (fake) data in empty views, in the hope of easing user onboarding. This can be enabled (in list and kanban views) with attribute sample="1" on the arch root element. In this case, if there is no data to display, sample data will be generated based on heuristics (depending on field types and names). This can be used in addition to the no content helper. Task 2232801 X-original-commit: 7c8e627ff5029cb539d702705e5ce53d658c76ed Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Jérémy Hennecart <jeh@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com>
Diffstat (limited to 'addons/web/static/tests/views/basic_model_tests.js')
-rw-r--r--addons/web/static/tests/views/basic_model_tests.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/addons/web/static/tests/views/basic_model_tests.js b/addons/web/static/tests/views/basic_model_tests.js
index 3d28a32cf2e..f57478e1252 100644
--- a/addons/web/static/tests/views/basic_model_tests.js
+++ b/addons/web/static/tests/views/basic_model_tests.js
@@ -1309,7 +1309,7 @@ odoo.define('web.basic_model_tests', function (require) {
res_id: 1,
};
- model.load(params).then(function (resultID) {
+ await model.load(params).then(function (resultID) {
var record = model.get(resultID);
assert.ok(record.data.date instanceof moment,
"fetched date field should have been formatted");
@@ -1317,7 +1317,7 @@ odoo.define('web.basic_model_tests', function (require) {
params.res_id = 2;
- model.load(params).then(function (resultID) {
+ await model.load(params).then(function (resultID) {
var record = model.get(resultID);
assert.strictEqual(record.data.date, false,
"unset date field should be false");
@@ -1340,7 +1340,7 @@ odoo.define('web.basic_model_tests', function (require) {
type: 'list',
};
- model.load(params).then(function (resultID) {
+ await model.load(params).then(function (resultID) {
var record = model.get(resultID);
var firstRecord = record.data[0];
var secondRecord = record.data[1];
@@ -1367,7 +1367,7 @@ odoo.define('web.basic_model_tests', function (require) {
type: 'record',
};
- model.load(params).then(function (resultID) {
+ await model.load(params).then(function (resultID) {
var record = model.get(resultID);
assert.strictEqual(record.data.date, false, "date default value should be false");
});
@@ -1391,7 +1391,7 @@ odoo.define('web.basic_model_tests', function (require) {
type: 'record',
};
- model.load(params).then(function (resultID) {
+ await model.load(params).then(function (resultID) {
var record = model.get(resultID);
assert.ok(_.isEqual(record.data.category.res_ids, [12, 14]),
"category field should have correct default value");
@@ -1958,7 +1958,7 @@ odoo.define('web.basic_model_tests', function (require) {
},
});
- model.load(this.params);
+ await model.load(this.params);
assert.verifySteps(['read'],
"there should be only one read");
model.destroy();
@@ -1996,7 +1996,7 @@ odoo.define('web.basic_model_tests', function (require) {
data: this.data,
});
- model.load(params).then(function (resultID) {
+ await model.load(params).then(function (resultID) {
var record = model.get(resultID);
assert.strictEqual(record.data.product_ids.data[0].data.date, false,
"date value should be in data, and should be false");