summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/sample_server.js
AgeCommit message (Collapse)Author
2021-02-17[FIX] web: do not display cover images in sample dataMohammed Shekha
Before this commit, in sample mode, cover images might be displayed in kanban views. It isn't what we want as those images are real images from the database, not sample ones, but randomly linked to the sample records (the id of many2one fields is randomly generated). This commit tweaks the SampleServer to always set many2one fields pointing to model 'ir.attachment' to false. task-2368505 closes odoo/odoo#66350 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-12-21[FIX] web: SampleServer: round float valuesMohammed Shekha
before this commit: when field is float type it display too much decimal precision value, it should be fixed to 2 precision for sample data. after this commit: float field will display 2 decimal precision value. task-2318503 closes odoo/odoo#55987 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Kamesh Patel <kat@odoo.com>
2020-08-12[IMP] web: sample data in reporting views (preparatory work)Mathieu Duckerts-Antoine
The present commit brings the global changes necessary to have sample data in the reporting views. This includes several modifications/ fixes of the sample server (many of them for better visual results). Task ID: 2282196 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-08-12[REF] web,purchase: SampleServer: mock registryAaron Bohy
This commit changes the API of the SampleServer's mock registry s.t. one can register a mocked version of a method, whatever the model. The former API required a specific model to be specified, and only applied on this model. However, in order to enable the sample data feature on the cohort view, the 'get_cohort_data' method needs to be mocked, whatever the concerned model. One can now register mocked methods for a specific model only (with key 'model/method') or for every models (with key 'method'). Task ID: 2282196
2020-08-12[IMP] web: sample data: generate better activitiesAaron Bohy
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>
2020-07-07[FIX] web: Make sample server tests deterministicJulien Mougenot
Before this commit, there were a few tests in the "sample server" suite that asserted that every group resulting of a "read_group" would contain at least one record, while there was actually a slight chance of it not happening. Now, the sample server used in the tests has been rendered deterministic and these kind of issues are completely avoided. closes odoo/odoo#54164 X-original-commit: a6d32ff46558b68ce3f19458f29c311ee5c658fd Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-06-22[IMP] web: add support of "sample" attribute in viewsJérémy Hennecart
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>