summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/core
AgeCommit message (Collapse)Author
2019-04-01[IMP] web: use Chart.js in graph viewMathieu Duckerts-Antoine
It has been decided to use Chart.js instead of nvd3 to render charts. In this commit the graph view has been largely rewritten to benefit from the options offered by Chart.js. Task ID: 1946138
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-22[MERGE] forward port branch saas-12.1 up to 0f4abc5c228Christophe Simonis
2019-02-21[MERGE] forward port branch 12.0 up to 84143a34b31Christophe Simonis
2019-02-12[FIX] web: quotes and backslashes in search viewMathieu Duckerts-Antoine
The commit 6d3ada178f7caf6ea159b871648ca4c440c7845b aimed to solve problems occuring whith (single or double) quotes when creating new custom filters. Unfortunately, the point was missed and bugs were still present. The present commit solves the orginial problem satisfactorily. There was also a problem in the management of backslashes. Type '\\' in the search bar would lead to a domain like [('...', 'ilike', '\\\\\\\\\\\\\\\\')]. This has also been fixed. Note that it is necessary to input "\\" if one is looking for a backslash in db (as before). A remark on the _formatAST function (py_utils.js): We deescape only the chars `'`, `"`, and `\` because it does not seem possible to produce a string in the search view that would intend a search for a line return or a tab for example. A general remark: Domains should always be in normalized form. In that way they could be manipulated and combined together without a tokenization/parsing! closes odoo/odoo#29756
2019-02-04[FIX] web: undestroyed widgets in testsXavier Morel
closes odoo/odoo#30794
2019-02-15[FIX] web: remove human_number limitationsMathieu Duckerts-Antoine
The formatting of very big numbers (like 1.0045e+22) was not handled adequately by the function 'human_number' in web.utils. For those numbers, it seems more appropriate to use the scientific format. The only difference introduced here is the following. Beyond a magnitude of e+21, we represent the numbers by themselves but we keep the number of decimals provided as parameter (or zero by default) and we remove useless zero decimals like in the other cases. For instance, 1.0045e+22 is replaced by 1e+22 instead of 1.00e+22 if ask 2 decimals of precision (and by 1.005e+22 for 3 decimals). We have also fixed a small bug occuring in the previous version of the function: the symbol 'E' was never used. So by the past the above number would have be represented as 10045000P and, even worse, 1.01e+45 by 1.012e+28P. closes odoo/odoo#31140
2019-02-15[FIX] web: quotes and backslashes in search viewMathieu Duckerts-Antoine
The commit 6d3ada1 aimed to solve problems occuring whith (single or double) quotes when creating new custom filters. Unfortunately, the point was missed and bugs were still present. The present commit solves the orginial problem satisfactorily. There was also a problem in the management of backslashes. Type '\\' in the search bar would lead to a domain like [('...', 'ilike', '\\\\\\\\\\\\\\\\')]. This has also been fixed. Note that it is necessary to input "\\" if one is looking for a backslash in db (as before). A remark on the _formatAST function (py_utils.js): We deescape only the chars `'`, `"`, and `\` because it does not seem possible to produce a string in the search view that would intend a search for a line return or a tab for example. A general remark: Domains should always be in normalized form. In that way they could be manipulated and combined together without a tokenization/parsing! closes odoo/odoo#31025
2018-12-12[MERGE] forward port branch 12.0 up to 047e2b28de4Christophe Simonis
2018-12-07[REF] web: move ControlPanel inside controllers/actionsGéry Debongnie
This branch introduces a large-scale reorganization of the component tree generated by the web client. The short version is that now, the control panel is a child of the view controller and no longer a sibling. Graphically (and simplified), we go from this: webClient / | \ ... ... actionManager / \ controlPanel viewController / \ to this: webClient / | \ ... ... actionManager | viewController / | \ ControlPanelController / \ CPRenderer CPModel The motivation is that this work moves the code where it should be. Before this commit, it was kind of weird to have code in the controllers to render buttons outside of their root node (in renderButtons). Also, the action manager had to take care of coordinating search view states between view transitions. So, this work simplifies the code. It also makes it easier to extend. We see day after day that Odoo needs to take care of more complex UI needs, and in many cases, these needs were quite difficult to implement (we prefer spaghettis in our plates, not in our code). The changes in this branch should open the way to implement these features. For example, - it will now be easy to add the possibility of views (for example, the search view or a new ControlPanel view) to add custom buttons (of type action or object) in the control panel. - Another need will be to serialize/ restore the state of the search view across action boundaries (needed by the dashboard). - Another example is the possibility for views to customize easily the presence/absence of sub menus (filters/groupbys/favorites/ time range/...) - Another need is an easier way for views/client action to customize their control panel. This commit also contains a large rewrite of the search view (so it is more inline with our architecture and easier to maintain). Part of task 1893568 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
2018-12-06[FIX] web: prevent crash when searching for escaped stringsGéry Debongnie
Recent works in the search view (in 12.0) on dynamic filters had an unfortunate effect: when the user tries to input escaped strings (for example "test" in custom filters, there was a crash. The reason is that the JS python parser (or more specifically, the tokenizer) was unable to parse that as a string. It worked before because the web client sent the raw string to the server. However, with dynamic filters, this is no longer the case, and we need to parse domains to be able to combine them. In this commit, we modify the tokenizer to be able to work with escaped strings. closes odoo/odoo#29324
2018-11-19[REF] *: update js test suite to use helpersGéry Debongnie
This rev. introduces robust helpers to use in the JS tests suite to interact with DOM and components, and starts using them (almost) everywhere. All the helpers are exposed though testUtils.js. There are 2 kinds of helpers: 1. Assertions ------------- * assert.containsNone, containsN, containsOnce check that the DOM (or a specific part of the DOM) contains a `selector`. It generates a correct error message automatically. ex: assert.strictEqual(form.$('.o_form_editable'), 1, "msg"); -> assert.containsOnce(form, '.o_form_editable'); * assert.isVisible, isNotVisible check that the DOM has an element visible or not. They also check that the element is actually in the DOM (before most tests didn't verify this). * assert.hasClass, doesNotHaveClass, hasAttrVAlue, check specific properties of a DOM element, and also validate that it is applied on a single existing DOM element (before most tests didn't verify this). ex: assert.notOk(form.$('button').hasClass('btn-primary')); -> assert.doesNotHaveClass(form.$('button'), 'btn-primary'); 2. Utilities ------------ The goal of the utilities is to centralize the definition of many standard components and interactions, ensuring that when we refactor the JS framework, we do not need to change all the tests. Existing mock utilities (addMockEnvironment, intercept, path, patchDate, unpatch and fieldsViewGet) are moved to 'testUtils.mock.*'. Existing DOM utilities are moved to 'testUtils.dom.*'. New dom utilities are created for opendDatePicker, click, clickFirst and clickLast. Helper `click` verifies that there is exactly 1 element visible in the DOM you click on, `clickFirst` and `clickLast` verify that there are more than one element on the DOM. ex: form.$('button').click(); -> testUtils.dom.click(form.$('button')); New Form utilities: (testUtils.form.*) clickEdit, clickSave, clickCreate, clickDiscard, all clicks on the control panel buttons of the form. `reload` reloads the form data. New modal, graph, kanban and pivot utils (testUtils.pivot.*, testUtils.kanban.*, etc.). New fields utils: (testUtils.fields.*) * editInput, editSelect: allow to change the value of a field, using a selector to identify it. They validate that the input exists and trigger the change event automatically. * editAndTrigger: allow to modify a field and trigger specific events after the value change * many2one (testUtils.fields.many2one.*) clickOpenDropdown, clickHighlightedItem, clickItem, searchAndClickItem: use a field name instead of a selector and do all the complex mechanism to open, filter and highlight many2one fields. Joint work with aab, dam, ged, mge, svs and vsc.
2019-01-10[Generic] unaccent searchmgh-odoo
- added unaccent search on POS customer/partner and product - moved unaccent from "mail.utils" to "web.utils" - added more character to make function accurate We might use str.normalize(from ES6) but the problem is str.normalize method can not consider some double characters i.e. accented character when normalized it returns 2 normal characters and normalize method returns single character, so here custom unaccent method is used to normalize the string What we can improve here: We can use str.normalize method and check if string is still have unaccented charaters that we can call our unaccent method but this unaccent method is also working and performing well closes odoo/odoo#27671
2018-09-14[FIX] web: tests: adapt JS tests from forward-port ↵Alexandre Kühn
9c77066f345360429a0920ca4d17af1f84a7ebea The test was failing because it was using an old approach to mock services in JS tests. Also, it provides ajax service in the list of services, which was not supported in a mocked environment. With this commit, when an ajax service is provided in the test, it will use this service instead of using mocked RPCs from the mocked server.
2018-09-14[MERGE] forward port branch saas-11.4 up to 6c103589c15Christophe Simonis
2018-09-10[FIX] web: ajax must return a promise with abort methodChristophe Matthieu
Remove part in service_mixins who hide this error. Queries must be able to be canceled for better performance. Also in the case of longpolling, if the request is not canceled, wait for a server message or the maximum time (30 sec) to add or delete channels.
2018-09-10[FIX] web: use correct variable nameChristophe Simonis
Oversight of previous forward-port.
2018-09-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-06[MERGE] forward port branch 11.0 up to 737ca0eb424Christophe Simonis
2018-09-06[FIX] web: adapt newly added test (2)Christophe Simonis
2018-09-06[FIX] web: adapt newly added testChristophe Simonis
Oversight of previous forward-port
2018-09-06[MERGE] forward port branch saas-15 up to 5a5d6d1e8e2Christophe Simonis
2018-09-06[FIX] web: no padding/border twice in `dom.autoresize`Alexandre Kühn
Before this commit, the `dom.autoresize` function may apply the padding and border width twice when computing the height of the textarea. This issue occurs when the fixed textarea had the same CSS style as the textarea. This commit fixes the issue by enforcing zero padding and border width in the fixed textarea. Task-ID 1882736
2018-09-05[IMP] web: concurrency: add getUnlockedDef to mutexAaron Bohy
This rev. adds a new function to the mutex concurrency helper: 'getUnlockedef'. This function returns a deferred resolved as soon as the mutex has no more task to execute (or directly if it is currently idle). Such a function was needed for an upcoming fix. Related to task 1878254.
2018-08-13[IMP] web: add method to convert JS domain into python conditionChristophe Matthieu
2018-08-13[IMP] web: add MutexedDropPrevious in concurrencyMartin Geubelle
This new helper is meant to solve the following use case: serialize a number of concurrent rpcs while skipping the rpcs that arrive in between the mutex.
2018-08-09[IMP] pyjs: add date/datetime utilitiesAdrian Torres
Introduce utilities to calculate the start / end of a period given a date or datetime object in the JS python interpreter. This commit is the JS implementation of commit 960360afe478a8f7b9c456721b5591154952a37d
2018-07-26[IMP] account: automatic communication management on out_invoicesLaurent Smet
On the accounting config, you can select an automatic way to compute the reference on invoice and then, improve the reconciliation in a later task: - free communication: set what you want as reference (default) - based on partner: find the partner more easily - based on number: retrieve the invoice directly Was task: 1847703 Was part of PR #25921
2018-07-20[IMP] web: core: ajax: loadCSS now returns a promiseeco-odoo
It is useful to know when the stylesheet has been loaded in order to prevent displaying unstyled content. CalendarView and the dashboard_graph widget (JournalDashboardGraph) use loadCSS through cssLibs / loadLibs so the tests now have to use createAsyncView instead of createView.
2018-07-06[IMP] web: easy selection of a period in filters menuMathieu Duckerts-Antoine
This commit allow to create easily a range of periods (related to a field of date or datetime type) to select in the filters menu. Two new attributes on elements with tag 'filter' are now usable in combination in a search view arch: - date: string. A valid field name with associated type date or datetime - default_period: string (optional). To choose in the following list: - 'today' - 'this_week' - 'this_month' (default) - 'this_quarter' - 'this_year' - 'yesterday' - 'last_week' - 'last_month' - 'last_quarter' - 'last_year' - 'last_7_days' - 'last_30_days' - 'last_365_days' Example: <filter string="Creation Date" name="period_generator" date="create_date" default_period="this_quarter"/> Note: the attribute 'domain' can not be used for such filters. The generated domains are dynamic and can be saved as such via the favorites menu.
2018-07-06[IMP] web: implement assemble domain utility functionMathieu Duckerts-Antoine
In this commit, we implement a function which allow to combine a list of domains into a single normalized using a 'OR' or an 'AND' operator. We also refactor slightly py_utils.
2018-07-06[IMP] web: implement normalize domain utility functionGéry Debongnie
In this commit, we implement a function which normalize a domain represented as a py.js syntax tree.
2018-07-06[IMP] web: implement formatAST utility functionGéry Debongnie
In this commit, we implement a function which format a py.js abstract syntax tree into a string. This is really useful whenever we need to manipulate python expressions.
2018-07-06[REF] *: rename web.pyeval into web.py_utilsGéry Debongnie
The pyeval name is quite confusing, given that there is already an eval and an evaluate function in py.js, and that the web.pyeval exports two evaluate functions. Since this file is more about odoo specific customization to py.js, it is renamed in py_utils to better express its intended use.
2018-07-06[IMP] web: add support of modulo in pyevalMathieu Duckerts-Antoine
2018-05-15[IMP] various: clean references to removed content_subtype post parameterThibault Delavallée
content_subtype was a parameter to message_post allowing to give plaintext content instead of html content. It has been removed at 74d4b3902d51bf805f87bfd853f54407137b0ac3. This commit cleans some leftover bits referencing this now removed parameter.
2018-04-12[FIX] web: prevent destroyed widget from calling startGéry Debongnie
Whenever a widget is destroyed, it should be as inactive as possible. Before this commit, it could happen that a widget was destroyed after the willstart method, but before the start method. In that case, bad things could happen. For example, the discuss client action tries to look up some information into the session, with the getSession method. This causes a crash whenever the widget is destroyed.
2018-03-08[MERGE] forward port branch 11.0 up to fcb48b72415Christophe Simonis
2018-03-08[FIX] web: 'image_small' field not displayed for non-latin translationstrue-datura
Before this commit, images in kanban view of the Contact app were not displayed on non-latin languages, such as Russian. This was caused by the is_bin_size helper that wrongly assumes that a certain string is not a binary size, although it is (e.g. 64.2 Кб). This commit fixes the issue by including such strings as valid binary sizes. Bug found and fixed by @true-datura Test by @alexkuhn closes #23526 closes #22519
2017-12-04[REF] web: update widget to new guidelinesGéry Debongnie
- make delegate/undelegate events private - remove $el before start - make replaceElement private - remove one _ from __render_and_insert... method - update documentation - remove make and improve make_descriptive (also, it is private) - ...
2017-11-24[FIX] web: read_group RPCNicolas Martinelli
Example of failing request: ``` rpc.query({ model: 'link.tracker.click', method: 'read_group', args: [[links_domain, ['create_date', '>', interval]], ['country_id']], kwargs: {groupby:'country_id'}, }); ``` The RPC request built contains the following: ``` args: [[["link_id", "=", 1]], ["create_date"]] kwargs: {groupby: "create_date:day", domain: [], fields: []} ``` This will be interpreted server side as: ``` model.read_group([['link_id', '=', 1]], ['create_date'], groupby=['create_date:day'], domain=[], fields=[]) ``` 2 arguments match `domain` and `fields`, which causes a crash. opw-781300
2017-06-27[FIX] web: pyeval_tests: typoAaron Bohy
Introduced by forwardport 34b432d528f9161e955b05757a898442ff4fbcf8
2017-06-26[MERGE] forward port branch saas-15 up to 4d79a1ff58fChristophe Simonis
2017-05-02[FIX] web: keep positional args for search_readDavid Monjoie
The previous code used to create its own args array for the search_read method, replacing the one that was originally given to it. This lead to silent errors since positional arguments to this function were completely ignored in the case of search_read. I took this commit as an opportunity to improve a bit on the current state of these rpc helpers. Namely, the basic args/kwargs priority is the following (top-to-bottom): - kwargs defined in the rpc call - kwargs defined in the kwargs key of the params kwarg of the rpc call - positional arguments are passed as is For read_group and search_read methods, the priority is the following: - kwargs defined in the rpc call - kwargs defined in the params kwarg to the rpc call - kwargs defined in the kwargs key of the params kwarg of the rpc call - positional arguments are passed as is For the /web/dataset/search_read controller, only the params kwarg is supported, resulting in the following priority: - kwargs defined in the rpc call - kwargs defined in the params kwarg to the rpc call - positional arguments are passed as is If both a kwargs and a positional arg is given for the same parameter, it will be sent as is to the server which will crash with a typical "got multiple values for keyword argument" TypeError. However, in the MockServer however, we give priority to kwargs over args in this case. Please note that I also chose to remove unnecessary default values so that the ones actually used are the ones from the server, not the ones that were duplicating those in the rpc js file.
2017-04-27[FIX] web: do_action should properly resolves when completeGéry Debongnie
We changed the do_action method recently: before, it was calling recursively its parent, now it simply triggers up an event. We also moved it to the 'services' mixin. However, we did not properly connect the 'on_success' option: it is not an option for the view manager, but for the abstract web client. As such, it should not be in the options parameter, but it should simply be a key in the event payload. This commit was found by solving the two following issues: - open sale application, click on 'Inbox' icon to go to discuss, Discuss is opened, but the navbar stays with sales application - after installing module website_crm_partner_assign in kanban view for apps, it does not reload... Both of these were caused by the need to do something after a do_action, and the deferred was not resolved at all.
2017-04-11[REF] account, web, web_diagram: rename static test folderGéry Debongnie
For consistency, every static test folder should be named 'tests', with a s.