summaryrefslogtreecommitdiff
path: root/addons/web/static/tests/helpers/mock_server.js
AgeCommit message (Collapse)Author
2019-04-02[IMP] web: fetch records alongside read_groupAaron Bohy
This rev. adds params to the 'web_read_group' method, allowing to search_read records inside each groups in a single RPC, instead of doing a 'web_read_group' RPC followed by n 'search_read' RPCs, where n is the number of opened groups. Part of task 1915702
2019-04-02[IMP] web,base: put buttons in list group headersMartin Geubelle
It is now possible to put buttons in the list view group headers. When the view is grouped by a many2one field, those buttons appear next to the header title when the group is opened. The buttons are specified in the views in a <groupby> tag in the list arch, with the following structure: <groupby name="groupedField"> <!-- must be a many2one --> <button type="object" name="my_method" string="Button1"/> </groupby> It is also possible to add `field`, inside the `groupby` which can be used for modifiers. These fields thus belong on the many2one comodel, like: <groupby name="partner_id"> <field name="name"/> <!-- name of partner_id --> <button type="object" name="my_method" string="Button1" attrs="{'invisible': [('name', '=', 'Georges')]}"/> </groupby> These extra fields are fetched in batch when grouping on the field. Part of task 1915702
2019-04-02[IMP] web,board: enable pagination in grouped listsAaron Bohy
With this rev., when there are a lot of groups in a grouped list view, groups are displayed under several pages, whereas they were all displayed in the same page before. This is especially interesting with the new 'expand' attribute, to ensure that we don't read records for a large number of groups. By default, the groups limit is set to 80 (like records), and to 10 is the 'expand' attribute is set to true. This limit can be overriden with the 'groups_limit' attribute. Part of task 1915702
2019-04-01[FIX] web: correct quarter format in mockReadGroupMathieu Duckerts-Antoine
Before this commit the value of a field (of date/datetime type) used as a groupby was not correctly formatted in the test environment when the granularity was 'quarter'. This commit fixes that situation.
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-28[MERGE] forward port branch saas-12.1 up to f9d3b5b7dfeChristophe Simonis
2019-02-26[FIX] web: search more in many2one: filter on idsAaron Bohy
Let's assume a many2one field with a lot of possible values. The user clicks on 'Search More...'. In the opened dialog, only 160 records are available (their ids have been obtained with a name_search, with the optional text the user could have typed in the many2one input). Before 4cd379cf, that extra domain on ids was removed automatically as soon as the user interacted with the search view in the dialog. This was especially useful when there were more than 160 records. However, this was rather an happy coincidence than a designed feature. From 4cd379cf, the ids selection was added to the initial domain of the list, so they couldn't be removed from the domain afterwards. The user was thus stucked with its preselected 160 records. This rev. doesn't restore the former behavior, but rather improves the current one, as follows: - when there is no text in the many2one input (i.e. no value to filter on), we bypass the name_search, s.t. all records are available in the dialog - when there is some text in the input, we perform a name_search (as before) to get a list of record ids, and we add a special filter to the search view in the dialog (the filter on those ids), s.t. the user can remove it if he wants to access the remaining records. - finally, the limit is now set to 320, to mitigate the problem Issue reported on the saas-12.1 migration pad. closes odoo/odoo#31232
2019-02-13[IMP] web: add kanban searchPanelAaron Bohy
This rev. defines a searchPanel widget used in Kanban views to refine search according to specific dimensions. This wigdet is displayed as a sidebar to the left of the kanban view. Part of task 1892462 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Raphael Collet <rco@odoo.com>
2019-01-29[ADD] web: server-side-rendered qweb templates as viewsXavier Morel
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-17[MERGE] forward port branch saas-11.3 up to 0de06a41326Christophe Simonis
2018-10-16[MERGE] forward port branch 11.0 up to b29b545fe84Christophe Simonis
2018-10-12[FIX] web: use read to update record values after resequencelen-odoo
Commit: https://github.com/odoo/odoo/commit/818c18e55d0718286ff5bf332186a10f4d7a58ef Updated the resequence logic in a way that was almost falser than before. The added test however did work by coincidence, as index values were equal to the sequence field values. To be sure that we synchronize with what happens on the server, we do a read after the resequence. Additionnally, we take into account the result of the server resequence return; if it is false, it means no resequencing happened, so we should not do a read. opw 1867049 closes odoo/odoo#27184
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-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-07[MERGE] forward port branch saas-11.3 up to 4850fb08385Christophe Simonis
2018-09-05[MERGE] forward port branch 11.0 up to 213759b03e5Christophe Simonis
2018-08-29[FIX] web: use an unused variable in mock serverlen-odoo
Fine-tuning of commit: https://github.com/odoo/odoo/commit/818c18e55d0718286ff5bf332186a10f4d7a58ef which introduced a variable that it didn't use. opw 1867049
2018-08-27[MERGE] forward port branch saas-11.4 up to a5187cef107Christophe Simonis
2018-08-24[MERGE] forward port branch saas-11.3 up to 3be46428ccfChristophe Simonis
2018-08-24[MERGE] forward port branch 11.0 up to 33981790de9Christophe Simonis
2018-08-24[FIX] web: fix js data during consecutive sequence of resequence moveslen-odoo
Let x_1, ..., x_a, x_{a+1}, ..., x_{a+k}, x_{a+k+1}, ..., x_{n} be a record sequence ordered by its 'sequence' field. Suppose the reordering occurs between elements x_{a+k} and x_{a+1}. If the subsequence x_1, ..., x_a is ordered, then it does not change. This is also true of the subsequence x_{a+k+1}, ..., x_{n}. The resquence function makes exactly this assumption, and only sends the server the subsequence x_{a+1}, ..., x_{a+k} to update its 'sequence' field. The update of x is done as follows: it is index + offset, where index is the position of x in the subsequence, and offset is the 'sequence' of the first element of the sequence (i.e. x_{a+1}.sequence). It is easy to see that we need another hypothesis: that the sequence numbers are unique. To show it, suppose that the sequence of x_1, ..., x_a is 0, then all x_{a+1}, ..., x_{a+k} have sequence 1, and lastly all x_{a+k}, x_{a+k+1}, ..., x_{n} have sequence 2. Then after the call to the server resequence, the subsequence x_{a+1}, ..., x_{a+k} would have sequence numbers 1, 2,..., k. Since the x_{a+k+1}, ..., x_{n} subsequence have 'sequence' value 1, this would obviously be incorrect. We fix the reordering of the data in the js frontend to be consistent with what is done by the server. Note that this is only pertinent for sequences of reordering moves, since otherwise the data comes directly from the server. opw 1867049
2018-08-13[FIX] web: MockServer: don't alter domain in placeAaron Bohy
In a test, we might want to check the domains given to RPCs with assert.step/verifySteps. Before this rev., if there were an 'active' field on the model, ['active', '=', true] was automatically added to the domain by the MockServer in place, thus altering the expected domain in the test.
2018-08-09[IMP] web: the service mixins _rpc method add the abort methodChristophe Matthieu
This change is usefull to convert the bus.bus into a sweet bus and cross tab bus service. Actually, if we use the _rpc mixins in the bus, the long polling can't be abort, and raise an exception.
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-05[MERGE] forward port branch saas-11.3 up to 2214bffefb2Christophe Simonis
2018-07-05[MERGE] forward port branch saas-11.2 up to 45329c0cf2cChristophe Simonis
2018-07-05[MERGE] forward port branch 11.0 up to 84210074e55Christophe Simonis
2018-07-04[FIX] web: mock fieldsViewGet don't delete raw attrsLucas Perais (lpe)
Have a view with a field as: <field name="stuck_in_the_middle" attrs="{'readonly': [('with_you', '=', False)]}"/> Before this commit, the contents of attrs were parsed and merged into the modifiers and the attrs attribute of the node was deleted which might cause divergence between reality and tests After this commit, the mock server does what the server does in this case closes #25583
2018-05-29[MERGE] forward port branch saas-11.3 up to 37eed7c509fChristophe Simonis
2018-05-29[IMP] web: _mockReadGroup method support week and yearJigar Patel
Before this commit _mockReadGroup method support only day and month aggregate function and return invalid domain for date type field. With this commit _mockReadGroup method support week and year aggregate function. And return correct domain having start date and end date if date type field.
2018-05-09[MERGE] forward port branch saas-11.2 up to aae54ecc159Christophe Simonis
2018-05-02[MERGE] forward port branch 11.0 up to 521414b1c10Christophe Simonis
2018-05-02[FIX] web: fix form_view_id attribute in calendar view.Géry Debongnie
The way the calendar view selected its form view was broken for two reasons: - any value given in the form_view_id attribute was kept as string, which means that the string value would be sent to the server, and this is not good. - if no value was set, the calendar view then simply did a do_action with the form view id set to false, which means that the default form view is used. This is mostly ok, except when we are in the context of an action with a form view which is not the default one. In that case, we clearly prefer the form view from the action. For example, before this commit, the form view in the timesheet application (community) is not the same as the default form view on account.analytic.line. Note that this commit also adds a small tweak to the mock server to better simulate errors like the web client does (in session.js).
2018-04-25[FIX] web: reload progressbar values after archiving recordsMartin Geubelle
Before this, the progressbar values were not updated (both count and progress) after archiving all the records of a column. Multiple things have been done here to update it. Firstly, a optimization had been done to avoid reloading the progressbar when updating a column ; this optimization was not correct due to this precise use case. This will update the progressbar. Secondly, the `aggregateValues` are reset when putting empty groups back in the datapoint. This attribute is used to compute the counter if a `sum_field` is set on the progressbar widget. It needs to be reset because the loop that computes it won't iterate on empty groups. Eventually, the mockRPC of the progressbar route was not taking the `group_by` argument into account (probably a typo).
2018-04-24[MERGE] forward port branch saas-11.2 up to 7fd9dbdd9f8Christophe Simonis
2018-04-24[MERGE] forward port branch 11.0 up to b9ce1affbf5Christophe Simonis
2018-04-24[FIX] web: preserve new column order after creationMohammed Shekha
When a user creates a new column in a kanban view, leave the action and comes back, the order is not preserved. With this commit, we force a call to resequence to ensure that the order does not change.
2018-04-10[IMP] web: allow using many2one as measure in pivot viewMathieu Duckerts-Antoine
With this commit, we add the possibility of using many2ones as measure. The way a many2one is aggregated is by using the count distinct operator. Some care had to be done to gracefully support the situation when a pivot view is grouped by a m2o field F, and the same field F is used as a measure.
2018-04-05[IMP] web: graph views can now aggregate many2onesMathieu Duckerts-Antoine
The read_group method was recently modified to allow more flexibility. With this commit, we add the possibility of aggregating many2one fields. These fields can be aggregating by counting the number of distinct IDs, directly in postgres. Also, note that we had to modify the mock server to implement the corresponding functionality.
2018-04-05[IMP] web: update mock server to better match server semanticsMathieu Duckerts-Antoine
The read_group method (from the server) is implemented in the mock server, to allow easy unit testing in javascript. However, the behaviour was not exactly the same: a read_group call on a domain with no records returns null for aggregates. But the mock implementation returned a value of 0. We fix this in this commit, to allow more precise testing of Odoo javascript.
2018-04-03[FIX] web,account,google_calendar: correcting previous commitRémi Rahir
corrects error added in c3d1eda0176b44fd3e43364427f8f00a28615c0d . Non-breaking spaces were explicitely added in the tests. This commit restores the proper behaviour.
2018-04-03[FIX] web,account,google_calendar: chasing breaking spacesRémi Rahir
Before this commit, some breaking spaces were present in the js code. Such spaces are misinterpreted and worked by luck. This has become a problem with exported js bunldes (e.g. the external_lib bundle in im_livechat). This commit replaces breaking spaces by regular spaces.
2018-03-01[MERGE] forward port branch 11.0 up to c2e878e34c8Christophe Simonis
2018-03-01[FIX] web: mock_server name_search use limit kwargChristophe Matthieu
We need support the limit arguments for name_search in unit tests.
2018-02-01[REF][IMP] *: mail js refactoringAaron Bohy
This commit improves the JS code of the mail module, which comes maily from the new coding guidelines and the addition of "JS services". JS services are important objects that do not fit well in the component tree, such as chat_manager or ajax. The benefits of JS services are improved readability of the code, reduced coupling, and more testable modules. In particular, discuss was hard to Summary of the changes: - ClientAction has been renamed into Discuss - Clear instantiation of chatManager - New coding guidelines in most mail modules - JS Services can interact with each other - Chat Manager and Window Manager are services - Window Manager renamed to Chat Window Manager - bus.bus is now encapsulated in Bus Service (a service) - The test infrastructure has been tweaked with JS Services - Chat Mixin has been removed A future improvement would be to translate some 'trigger' into 'trigger_up'.
2018-01-26[IMP] web: Kanban: quick create record with more fieldsAaron Bohy
This rev. improves the QuickCreate widget for grouped Kanban views. It allows specifying in the Kanban arch a form view xmlid, e.g.: <kanban quick_create_view="some_form_view_xmlid"> ... </kanban> When this attribute is set, the referenced form view is loaded and rendered inside the QuickCreate widget. A real FormView widget is instantiated, meaning that all form view mechanisms are available in the QuickCreate (modifiers, default_get, onchanges, widgets...). Task #27475.
2018-01-26[REF] web,*: move fvg processing from DataManager to ViewsGéry Debongnie
*: mail, web_diagram
2018-01-16[REF] web,*: ActionManager/ViewManager refactoringAaron Bohy
This rev. is the first part (out of 3) of the refactoring of the ActionManager and ViewManager layer of the webclient. The main changes are: - there is no ViewManager anymore, its work is now handled by the ActionManager itself, but isolated in a specific file ; this eases a lot of things, as the breadcrumbs handling for example. - the ActionManager code is converted to the new coding principles and guidelines ; mainly, children widgets communicate with it by triggering events up, and not by function calls anymore. - the ActionManager layer is now testable, and a lot of tests have already been written. - the code in other addons has been adapted consequently. What's coming next: - introduce the 'AbstractAction' Widget, and make client actions and view controllers inherit from it ; this widget will implement a common API that could be used uniformly by the ActionManager (e.g. restore(), canBeLeft(), renderButtons(), getTitle()...). - move the ControlPanel handling from the ActionManager to the AbstractAction.