summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
AgeCommit message (Collapse)Author
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-10-11[FIX] web: restore broken datepicker input behaviorMartin Geubelle
In Firefox, the input behavior and visual representation (navigation, caret placement, value selection, etc.) was broken when using a datepicker (easily reproductible on date and datetime widgets). This was due to the `focus` event being stopped on the input, which doesn't seem to be correctly supported by Firefox. The deleted code was supposed to toggle the picker when the field was clicked (see odoo/odoo@89093a1) (toggle on click and disable focus) but the lib correctly supports on focus without extra code. This also fixes the fact that the datepicker was not open on focus (only on clicked). In some tests where the field was the first in the form view, it is now correctly autofocused. Forward-port: not useful from 12.0 because the code has changed with BS4 and this has already been applied in odoo/odoo@6692919 and odoo/odoo@c63630d. Closes #23438 closes odoo/odoo#27657
2018-10-09[FIX] web: Make datetimepicker configurable in datetime fieldssvs-odoo
The datetimepicker option was introduced to be able to customize the datetime picker widget in date/datetime fields. However, due to the way the _makeDatePicker function was coded, it did not work in datetime fields. Thank to Yajo for the initial fix closes odoo/odoo#27541
2018-09-14[FIX] web: graph_renderer: check graph data before renderingMartin Trigaux
cherry pick of 634de21b76b9 Before this commit, we had two different errors when data was unavailable: The first one is generated by Odoo: "No data to display, try to[...]" The second one is generated by nvd3: "No Data Available". We always want the same message. So now, we always make some checks before rendering the graph by calling _render. opw-1874349
2018-09-14[FIX] web: JournalDashboardGraph widget crash Mk.IIMOENS Alexandre
Hardening of commit:995610c065bf0242cb5023cfad2940234395739e The JournalDashboardGraph requires nv, which is lazyloaded. However it requires nvd3.js which is loaded after nv.d3.js. A function called in destroy is defined by nv.d3.js, which can make the crashhappen with the right (wrong) timing. opw 1873749
2018-09-14[FIX] web: lock handle when sorting on a different fieldlen-odoo
The resequence mechanism works if the sequence is sorted by its handle field. Therefore sorting on another field should lock the handle, while sorting on the handle field should unlock the handle. opw 1867049
2018-09-12[FIX] web: revert ignore default_* on group creationNicolas Lempereur
This reverts commit 4cb585ab4f880147fbe35eb988c3c1da9728f624. When creating from the kanban view: - crm.stage - hr.recruitment.stage - project.task.type - helpdesk.type - mrp.eco.stage We go from a dashboard of eg. "GroupRecord" named "group_id" in the record. And when a stage is created, "default_group_id" is used. With the change the stage was not linked to the current "grouping". We could probably use "search_default_group_id" instead but the behavior may be present in existing customization. opw-1884217 closes #26943
2018-09-11[FIX] web: lock handle when sorting on a different fieldNicolas Martinelli
This makes runbot Enterprise fail. Reverts until a proper solution is found. This reverts commit f4f1480a3e6c437c7d14929fadd0782a53171dd5.
2018-09-08[FIX] web: forward-port 10.0->11.0 (CORS error handle)Romain Derie
CORS error was firsly fixed with 4bd8e3e2ed48 in 11.0 Then it was cherry-pick'd and improved in 10.0 with 9f1438d5f1b. But the improvement was lost during forward port from 10.0 to 11.0. This commit adds the lost fix. Closes #26812
2018-09-07[FIX] web: FieldDomain: reset field with a new domainAaron Bohy
Before this rev., there was a crash when a FieldDomain was reset with a new domain (e.g. coming from an onchange). For instance, it crashed in Email Marketing > create new Mass Mailing > select mailing lists. Introduced by 68332a01. opw-1882850
2018-09-06[MERGE] forward port branch saas-15 up to 5a5d6d1e8e2Christophe Simonis
2018-09-06[MERGE] forward port branch saas-14 up to c7de55dc3cbChristophe Simonis
2018-09-06[MERGE] forward port branch 10.0 up to 72f76caa39fChristophe Simonis
2018-09-06[FIX] web: relativedelta>11months work as expectedNicolas Lempereur
Since march 2015, using in a domain "relativedelta(months=X)" with X being bigger than 11 or lower than -11 would result in an error. This is because in the refactoring adding modules (e8a00bc50d) the two functions divmod and utils.divmod with different implementation in pyeval.js were replaced by one function divmod in web.utils module. But there was still an usage of the removed implementation. opw-1880766 closes #26816
2018-09-05[FIX] web: lock handle when sorting on a different fieldlen-odoo
The resequence mechanism works if the sequence is sorted by its handle field. Therefore sorting on another field should lock the handle, while sorting on the handle field should unlock the handle. opw 1867049
2018-09-05[FIX] web: time displayNicolas Martinelli
The calendar should use the time format of the language parameters. Partial backport of d4b5668c1adf7430b5b53c8600ed89f672d0c76b opw-1881335
2018-09-04[FIX] web: ignore default_* on group creationNicolas Lempereur
When a column is created in the kanban view, the context of the window action is fully given but it may contain default_{field_name} context keys that are intended for the action model. eg. on a product.product view we could have {default_type:'product'} in the context, if we grouped by company_id and created a new company, we would the context is propagated and we would try to set type='product' on the company (which causes an error). Without the change, the added test fails with: default_* should be removed from context, actual: "true", expected: "false" opw-1879064 closes #26676
2018-09-03[FIX] web: load more with progressbar load moreNicolas Lempereur
Be in a grouped kanban view with progressbar with limit 10: - records 1 to 10 are loaded on a column - do "Load more..." on a column => records 11 up to 20 are loaded - do "Load more..." 2nd time => records 11 up to 20 are loaded - do "Load more..." 3rd time => records 11 up to 20 are loaded - ... While in reality it should be: - do "Load more..." 2nd time => records 21 up to 30 are loaded - do "Load more..." 3rd time => records 31 up to 40 are loaded - ... This was caused by the progressbar reloading the column's group. This set the loadMoreOffset to 0 thus forgetting the current state. Without the change, added tests failed with: records of column are loaded => actual: "1,2,2", expected: "1,2,3" opw-1878359 closes #26628
2018-09-03[FIX] web: tab selects first many2one entry without triggering spurious createlen-odoo
Suppose you select a customer for a sale order. You type the beginning of his name "think", and a name_search is triggered which finds matching results, with first result "Think Big Systems". There are three ways to select it: click, enter or tab. Now there can be a warning set on this customer ("Bad client, only accept cash", or "good client, offer discount"). In that case, clicking on tab would trigger the onchange displaying the warning, but it would also set floating to true, which means a dialog to create client "think" would appear. This happens if the onchange is delayed, and thus the call to reset the floating state is triggered only after the focusout completed, instead of before. Coauthored with @aab-odoo opw 1866619 opw 1874475
2018-08-31[FIX] web: display values according to widgets in pivot viewlen-odoo
The pivot view didn't take into account the widget set on the fields. In particular this was a problem for float fields that store time values. They are now displayed with float_time if declared as such in the view. opw 1876445
2018-08-30[FIX] web: fix evaluation context of the domain selectorAaron Bohy
The domain was instantiated without being given any evaluation context. As a result, the uid variable was not defined, crashing the js if present in a user-defined filter. opw 1866852
2018-08-28[FIX] web: accept false value in comparisonMartin Trigaux
momentjs `isSame` method considers undefined values but not false our method _isSameValue does consider false Correct the error when running web tests Deprecation warning: value provided is not in a recognized ISO format
2018-08-27[FIX] web: Graph: group by two fields on line chartDipalee Bhalodia
Before this commit, when we applied two or more groupbys in line graph, the groups displayed on the X axis where shifted to the left, and the first one wasn't displayed at all. related task: #1848289 Closes: #25037
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-22[FIX] web: esc cancels kanban column quick createDavid Monjoie
The feature was already declared in AbstractQuickCreate, but the ColumnQuickCreate object did not define a _cancel function.
2018-08-17[FIX] web: open group in list => keep line selectionNicolas Lempereur
You: - open a grouping in a list view - check a line of this grouping - open another grouping => all checkbox are unchecked With this commit, 0982ceaa is improved so the selection is only reset when the list has been reloaded. opw-1865736 closes #26213
2018-07-16[MERGE] forward port branch saas-14 up to ed99894ac63Christophe Simonis
2018-07-16[MERGE] forward port branch 10.0 up to 13e321325b9Christophe Simonis
2018-07-16[FIX] web: groupby product on package types triggers a js errorlen-odoo
On a database where many modules are installed (e.g. runbot all), with the option "manage available packaging options per products", doing a groupby "product" on the "package type" list view triggers a js error. It comes from the fact that the fixed_group variable contains a "length" attribute; the _().each function uses this to determine (erroneously) that the object is an array. It thus uses fixed_group[0] to get an undefined, and then tries to access a method of undefined. We replace the each by a simple js loop. opw 1863576
2018-08-06[FIX] web: better detection of non specify `group_by` in pivot viewsChristophe Simonis
2018-08-01[FIX] web: kanban progressbar css fixupLucas Perais (lpe)
fixup of dc253ff1c65029e3795c1e49da0b16aa9e90db2a
2018-07-30[FIX] web: kanban progress bar, auto widthLucas Perais (lpe)
Have ~50 records in a column, Mark 49 of them as blocked (kanban_state field) Mark 1 or 2 as done Before this commit, the bar that showed the proportions of blocked objects was invisible This was because the min-width of a bar was 10px, without max-width Leaving the red bar to 95% or something, the green bar to 10px All of this overflowing 100% After this commit, we compute max-width and min-width to be able to fit everything within the progress bar OPW 1867464 closes #25962
2018-07-19[FIX] web: format value of statinfo widgetlen-odoo
The value of the statinfo widget is rendered by the qweb after a t-esc. Say if the python rounding returned 14.0000000001 (supposed to be a two digits precision number through the magic of floats) then the statinfo widget would print it as-is. We now format the value at assignation. opw 1865426
2018-07-16[MERGE] forward port branch saas-15 up to f0e280e5eb1Christophe Simonis
2018-07-06[FIX] web: trigger a warning modal when deleting a line while editing in a ↵len-odoo
one2many In a one2many, if the user clicked the trash button while editing another line, the row was not unselected. Thus the modal was not triggered, which entailed that the currently edited line was always saved. In particular, it allowed to give empty values to required fields. opw 1834346
2018-07-05[FIX] web: handle onchange on a on2many with an embedded one2many on ↵len-odoo
multiple pages Suppose there is a one2many field embedded in a one2many, (say we are viewing record A with one2many field B itself with a one2many C). Furthermore, there is a second page of the one2many field B. If an onchange is applied on B, then the server replies with a 1 command for all B records attached to the currently viewed object A. This includes a list of commands [[5], [4, C_id]*] for each B record, in particular B records that are on the second page. Since they are on the second page, they might not have been fetched by the frontend; in that case the corresponding C_ids are thus unknown. As a consequence, on save the frontend sends a command 0 to create the records for all unknown C_ids. Since it doesn't have any value to give to the 0 command, the row creation usually crash in the backend. Another wrong behaviour is fixed at the same time: if the server sends an update on the list of C ids with 4 commands. In that case, if the record has not been prefetched, we have no way to know if the list changed or not. To solve this, when we receive the 4 commands by the server, we send back 4 commands. coauthored by @aab-odoo opw 1835936
2018-07-05[FIX] web: no concurrent reload on basic modelAlexandre Kühn
Before this commit, there was a traceback in the following scenario: Let's have a kanban view with groupby and a domain. If we clear the domain then clear the groupby, there could be a crash. This crash occurs because when we clear the groupby, it performs a `reload`, and assumes that the datapoint contains grouped data. However, if this computation takes some time, it is possible to overwrite the datapoint so that there is no longer grouped data. This commit fixes the issue by enforcing at most 1 execution of the method `reload` active at any time. Consequently, successive reloads operations are now much slower. Note that it uses the single non-reentrant mutex on the basic_model to enforce this rule, which means: - No more concurrent `reload` and `save`. - If an execution having the mutex in `reload` come accross the same mutex, it is blocked forever. This is hopefully not the case at the moment, however a reentrant mutex should be considered in the future.
2018-07-03[FIX] web: Email attachment issueGoffin Simon
Steps to reproduce the bug: - Go on a SO and click on "Send by email" - Remove the attachment and click on "Add an attachment" - Choose an attachment A and remove it by clicking on the cross - Click on "Add an attachment" and choose the attachment A Bug: The attachment didn't appear in the modal. opw:1862482
2018-06-22[FIX] *: Avoid BlockUI for some rpcAdrien Dieudonne
Before this commit, the point of sale displayed a loading message every 5 secondes if the barcode scanner was configured. This issue is due to the following commit: @1aacc96 After this commit,some calls may block the interface when they did not do it before. It concerns all rpc done with ajax.rpc and all done with a new session. We have now to explicitly set shadow property. opw-1860493
2018-06-22[FIX] web: onchange on not loaded inline list viewNicolas Lempereur
Let's assume a one2many A inside a form view, such that the one2many views (list, not editable, and form) are defined inline, and there is an onchange on A. There is another inline one2many B editable list displayed in the inner form view (and B isn't in the list). There are two records on the one2many A, both of them having one record in their one2many B. Edit the first record of A, and edit it's subrecord in B. Click on save. This triggers an onchange on A and the onchange returns a command 5 (DELETE_ALL), and two commands 1 (UPDATE). Now edit the second record of A, and simply close the dialog (e.g. 'Discard'). Save the main record: the record in one2many B of the second record of A has been duplicated. This occured because the code in BasicModel messed up information coming from the onchange (UPDATE command) and from the read (performed when opening the second record), thus producing a CREATE command instead of an UPDATE one. This rev. ensures to properly mix the read data with the onchange result, by transfering the changes over the list datapoint created after the read. opw-1836785 closes #25330
2018-06-15[FIX] web: do no drop invalid record in list on discardAlexandre Kühn
Revision on b09f0c99 The intent of the previous commit was to no drop records in a list on discard in the following cases: - when they have been created from a `default_get` - when they have been created from an `onchange` that result from a `default_get` Before the commit above, the kind of records that were abandoned in those cases are stated as invalid, which happens when a record has a required field that is empty. The case of an `onchange` that is not involved in a `default_get` was not considered in the fixes above. In fact, this is the intent behaviour in most cases. However, if the items in the list are created from such an `onchange`, we should not drop them. This commit fixes the bug where records in a list that are created from an `onchange` are wrongly abandoned. Here is the new logic to abandon a record on discard in a list: - the record that is marked as "do not abandon" should not be abandoned; - a record that is registered as a "not new addition" in the list should not be dropped; - a record that is registered as a "new addition" in the list, and has been updated afterwards, should not be dropped; - a record that is not new should not be dropped; opw-806650
2018-06-15[FIX] web: fix ace editor when value is FalseJeremy Kersten
Avoid to crash the client web with setValue(false). false.match, false.split, false.length... will not works. Before this commit, _render call the setValue after comparing '' !== false
2018-06-14[FIX] web: checks rpc responses in web.ajaxAdrien Dieudonne
Before this commit, load_action and load_views were never resolved in case of internet connection loss. It's because the call is triggered by web.rpc direcly who uses ajax.rpc without any response check. Now the rpc response is checked in web.ajax. Thereby all responses are handled whether they come from session.rpc or rpc.query. Plus, it was not the responsibility of the session to check the rpc responses. Steps to reproduce the issue: (1) load_action: - Go to the app switcher for the first time - Force disconnected from the network -> No notification appears and the user aren't notify (2) load_views (mobile only): - Go to Sales -> Quotation (In this case, the first call is 'load_views' because we need to force to load some views like kanban view) - Force disconnected from the network -> No notification appears and the user aren't notify Note: It's now important to notify the user about connection loss because a recent improvement in mobile app replaces the 'retry screen' and lets the webclient handle connection issues by itself. The single odoo mobile app is supposed to work with all databases from 10.0.
2018-06-13[IMP] web: Expose datepicker configuration to view declarationsJairo Llopis
The lower-level widget itself supports passing options to the underlying datepicker library. However this is not exposed to higher-level view declaration. With this patch, one can declare a field in a view such as: ```xml <field name="datefield" options='{"daysOfWeekDisabled": [0, 6]}'/> ``` That option would land in the widget and disable those weekdays. Documentation has been updated accordingly. Closes #25044.
2018-06-12[FIX] web: prevent web client from blocking some viewAdrien Dieudonne
Before this commit some rpc was blocked and we didn't see lost connection notifications. Steps to reproduce: 1) Go to any form view 2) Force disconnected from the network -> The "Connection lost" notification appears 3) Get connection back -> The "Connection restored" notification appears 3) Close the connection again -> No notification appears and the user aren't notify that the internet connection is lost. Related commit: @47cf31b53 Note: It's now important to notify the user about connection loss because a recent improvement in mobile app replaces the 'retry screen' and let the webclient handle connection issues by itself. The single odoo mobile app is supposed to work with all databases from 10.0.
2018-06-06[FIX] web: new record with o2m also with new records prevent name_getLucas Perais (lpe)
Have a model A with a o2m to B. In the list have a field B > m2o > C Also have a sequence field (widget handle) on B Then Create a record A Arrange yourself to have two new records B popping right away (through an onchange) in the o2m. Their C field have to be empty Resequence those two B lines with the handle Before this commit, there was a traceback when trying to do an name_get on the C fields Since both of them are empty, there is no record in the localData Hence, no model. And also no records anyway, so no need to do a name_get After this commit, there is no traceback, the name_get is avoided when no data is to be fetched OPW 1853088 closes #24988
2018-06-05[FIX] web: display correct week number in calendar viewslen-odoo
To compute the week number, the fullcalendar.js library uses the locale. It depends on the day on which the week starts (usually Sunday in the Americas, Monday in Europe), as well as which week is considered the first of the year. In commit: https://github.com/odoo/odoo/commit/717b472ef9ad6d2998cbefb4aafe2d1199e6235d the starting day was explicitly added, however it was computed as isoWeekday. The ISO first day of the week is always on Monday. It resulted that if the locale used Sunday as first day of the week, the calendar would consider it to be of the previous week, and thus displayed (weeknumber - 1). The fix does the same thing as was done in v10, taking the locale into account: https://github.com/odoo/odoo/commit/df124080b624a8bdb86fec352fe690725ed36bac opw 1853745
2018-05-29[FIX] web: domain evaluation in parented m2o in o2m listLucas Perais (lpe)
Model A has a o2m to model B Model B has a m2o parent_id on B In A's form, add a B item, then in the m2o, create record Save and New Click on the m2o Before this commit, the python crashed on name_search. This was because we sent the virtual ids to it After this commit, there is no crash OPW 1850212 closes #24948
2018-05-28[FIX] web: o2m editable decorated, paged, ordered supports adds/cancelLucas Perais (lpe)
Have a decorated (conditional on field) editable list, with a default_order. Have more records than the pager allows. Add an item, and hit escape to cancel addition. Before this commit, the cancellation crashed because the first record on the other page was trying to evaluate the decoration for its row, which is wrong in the first place. This was because creating a record increases the limit of the list, to be able to see the record being created. At cancellation though, that limit was never decreased. After this commit, the whole flow happens without problem. OPW 1844495 closes #24682
2018-05-25[FIX] web: AbstractController: handle concurrent reloadsAaron Bohy
Let's assume the following scenario in a Kanban view with a default filter. The user removes the filter, and quickly adds a new one. On a slow network, it may happen that the second reload request returns before the first one. On odoo.com, this is easy to reproduce on the tasks Kanban view. Before this rev., when this occured, the result of the first request was displayed, whereas it should have been ignored as another request was done later on.