diff options
| author | Aaron Bohy <aab@odoo.com> | 2020-08-10 13:52:49 +0000 |
|---|---|---|
| committer | Aaron Bohy <aab@odoo.com> | 2020-08-12 10:07:32 +0000 |
| commit | d0bf6192d2091d1b7eb4c1cc771b46e34e6c78ac (patch) | |
| tree | 30e1309a3d22933d94414d263cc3b8925b5459d7 /addons/web/static/src/js/views | |
| parent | d761a73ad005b537354271396ba088c3fcfffceb (diff) | |
[IMP] web: sample data: generate better activities
The SampleServer picks a random value for selection fields. As a
consequence, field 'activity_exception_decoration' is always set,
either to 'warning' or 'danger'. When this field is set, widget
'ListActivity' (set on 'activity_ids') displays 'Warning', whatever
the value of 'activity_ids'. This means that with sample data, the
next activity field always displays "Warning", which is not great.
This special case has been handled in web, as it is the first (and
only) one. In the future, if we have to implement several special
cases like that, we'll setup a proper hook to allow external
modules to define them from the outside.
Task 2316726
closes odoo/odoo#55703
Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/sample_server.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/sample_server.js b/addons/web/static/src/js/views/sample_server.js index f6c0ca7903a..d5732aa979a 100644 --- a/addons/web/static/src/js/views/sample_server.js +++ b/addons/web/static/src/js/views/sample_server.js @@ -254,6 +254,15 @@ odoo.define('web.SampleServer', function (require) { return [...new Set(ids)]; } case "selection": { + // I hoped we wouldn't have to implement such special cases, but here it is. + // If this (mail) field is set, 'Warning' is displayed instead of the last + // activity, and we don't want to see a bunch of 'Warning's in a list. In the + // future, if we have to implement several special cases like that, we'll setup + // a proper hook to allow external modules to define extensions of this function. + // For now, as we have only one use case, I guess that doing it here is fine. + if (fieldName === 'activity_exception_decoration') { + return false; + } if (field.selection.length > 0) { return this._getRandomArrayEl(field.selection)[0]; } |
