summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
AgeCommit message (Collapse)Author
2019-01-14[FIX] web: form: call discardChanges while savingAaron Bohy
Before this rev., there was a race condition when the user did some changes on a form view (triggering an onchange), saved and clicked on the breadcrumbs to leave the form view (before the onchange returned). As a consequence, the dialog telling the user that there are pending changes was displayed. This mostly occured on the main_flow_tour since the removal of an unnecessary check, and could be reproduced manually on a slow network. Basically, the check if there were pending changes was done too early (before the view was actually saved).
2019-01-08[MERGE] forward port branch saas-11.3 up to 2d824a5b7adChristophe Simonis
2019-01-08[MERGE] forward port branch 11.0 up to c07b7200b26Christophe Simonis
2019-01-04[MERGE] forward port branch saas-11.3 up to 27a084eb814Christophe Simonis
2019-01-04[FIX] web: X2Many read propagates field contextNicolas Lempereur
Most operations on X2Many widget possibly propagates a field context (name_create, name_search, ...) but the original read or read on an onchange does not. With this changeset, the field context is also used in these instances. The assertions added in the added test failed with: expected: ["world"], result: [undefined] expected: ["world","world"], result: [undefined,undefined] fixes #29203 opw-1914466 closes #29866
2019-01-02[MERGE] forward port branch 11.0 up to d82c0d133edChristophe Simonis
2018-12-19[FIX] web: read records up to list limitlen-odoo
Fine-tuning of commit e7fab234201e357da52c3576ad2e8fc9ceee9359 In a one2many with more than one page with a limit of k records, add a line l. It increments the list limit to k+1. Remove a line above (of index <= k). It will try to load a line l' to replace it, that it will find on page 2. However when deciding if it should read missing fields on that record, it will scan at most u records, skipping virtual ids. Here u is the min between the current number of lines and the list limit without the temporary increase due to the added record. Since there are at least two pages, u = k. However since l is in the list at index k, then l' won't be read, and since it was on page 2 its data hasn't been loaded. Therefore the js would traceback when trying to evaluate it. opw 1913361 closes odoo/odoo#29338
2018-12-18[FIX] web: x2m in x2m with different fields in different viewsMartin Geubelle
Use case: a x2m (ex: attribute values) displayed in a x2m (ex: attributes on product) using different fields in different views (ex: tags in product form view and list in product attribute form view). When opening the x2m record (in a wizard) then going back on the form view, the tags are empty because the `display_name` value has been lost when fetching x2m for the second time. In this case, the list `fieldsInfo` needs to be updated with the existing (default for tags) one so all the fields will be correctly loaded. Task 1916891 closes odoo/odoo#29598
2018-12-04[MERGE] forward port branch 11.0 up to 2156af480fdChristophe Simonis
2018-12-18[FIX] web: call _applyX2ManyChange with the correct viewtypeNans Lefebvre
Have a one2many display records in a kanban subview, which opens a form view when edited. Edit a field displayed only on the form view. A call to _applyX2ManyChange is done without giving it the viewtype argument, therefore the fieldinfo is taken from the wrong view, traceback ensues. opw 1914163 closes odoo/odoo#29607
2018-11-30[FIX] web: prevent crash in some cases (o2m)Géry Debongnie
Recent works in the orm (see [1] for example) changed the behaviour of the server in the case of onchanges: it tries to optimize Odoo by sending a minimal diff to the web client in onchanges. Concretely, this means that the web client receives commands 4 (link to) instead of command 1 (update + record data). It also sends a minimal diff in that case. This is a big issue for the web client, because it relied on the knowledge of the data from the command 1 to be able to evaluate some modifiers. The good news is that we can mitigate the issue in one case: we do not actually need to evaluate the modifiers in the case of a command 4 (comming from the server), because we can assume that the record is valid. So, we simply bypass the check in that case. Note that this should fix most of the problem, but a deeper problem still remains: a crash can still happen when an onchange modifies a record in a one2many (but in a different page), and we also have a modifier which needs to be evaluated. opw: #1904514 [1] https://github.com/odoo/odoo/pull/29086 closes odoo/odoo#29172 closes odoo/odoo#29086
2018-11-28[MERGE] forward port branch 11.0 up to bb6f6c57f97Christophe Simonis
2018-11-30[FIX] web: prevent crash in some cases (o2m)Géry Debongnie
Recent works in the orm (see [1] for example) changed the behaviour of the server in the case of onchanges: it tries to optimize Odoo by sending a minimal diff to the web client in onchanges. Concretely, this means that the web client receives commands 4 (link to) instead of command 1 (update + record data). It also sends a minimal diff in that case. This is a big issue for the web client, because it relied on the knowledge of the data from the command 1 to be able to evaluate some modifiers. The good news is that we can mitigate the issue in one case: we do not actually need to evaluate the modifiers in the case of a command 4 (comming from the server), because we can assume that the record is valid. So, we simply bypass the check in that case. Note that this should fix most of the problem, but a deeper problem still remains: a crash can still happen when an onchange modifies a record in a one2many (but in a different page), and we also have a modifier which needs to be evaluated. opw: #1904514 [1] https://github.com/odoo/odoo/pull/29086 closes odoo/odoo#29172
2018-11-29[MERGE] forward port branch saas-11.3 up to c0eef427111Christophe Simonis
2018-11-28[FIX] web: context orderedBy not propagated to x2mLucas Perais (lpe)
Have: - Model A with a x2m to model B - Object A with multiple objects B in x2m (that will be sorted) - On the list view of model A, click on a column to sort by a field - this field shall not exist in B - open a record A (towards form view) Before this commit, the sorting of the x2m crashed, because the key orderedBy was propagated Due to commit e713ed2a69af9fe97fbe2d54843adc8f1ce689aa After this commit, it doesn't crash OPW 1913133 closes odoo/odoo#29094
2018-11-22[MERGE] forward port branch 11.0 up to 263b388c504Christophe Simonis
2018-11-20[FIX] web: implement filter orderedByLucas Perais (lpe)
related to: #28446 On a pure list view, click on a column to sort the records by that field. Save the filter as favorite Reload, now apply the filter Before this commit, there were two issues: 1. The order of the list was never propagated to search view, which couldn't save the filter with its attribute "sort" 2. There was no mechanism to load the attribute sort from a loading Filter After this commit, those two issues are corrected Unfortunately, complex search view flows are not testable in v11.0 OPW 1906968 closes odoo/odoo#28766
2018-11-19[FIX] web: m2o+o2m in o2m onchange no lose dataNicolas Lempereur
Steps: - open a modal form view from tree view first line and make a change - open a modal from the second line and make a change - open the second line back: the change were lost In a given number of conditions (a many2one inside the form view, there is a one2many in the form view not inside the tree view, ....) this happened because: - when we save the first line, we get onchange data for the second one - this onchange data can't be applied before second line is loaded, but it is saved so it can be applied if second line is ever opened - when the second line is opened the saved change is applied => OK - when the second line is opened a second time the saved change is applied again, possibly overwriting posterious change => BAD With this changeset, when the record with unapplied onchange is loaded for the first time, the unapplied onchange is applied only once. Added test without the change failed with: - only 1 turtle for second partner (result: 0 not 1) - second partner turtle is Michelangelo (result: "" not "Michelangelo") opw-1846820 closes #28644
2018-11-15[FIX] web: update renderer when _callButtonAction failedMohammed Shekha
Before this rev., the following scenario didn't work: Open manufacturing order and click on Produce button (note that bom product should have Serial number enabled) then add quantity in Done field in o2m and press Record Production button in wizard, it will produce UserError and after then if you change Lot number field in wizard's o2m then the many2one value doesn't get selected. This occured because the renderer wasn't updated after the RPC fail and thus still got an outdated version of the state. The issue raised after commit: 02eef78bbd3 which was done to remove useless rpc call, it's OK to remove rpc call but let's keep updating renderer. Related to task ID: #1852715 Co-authored-by: Tejas Shahu <tsh@odoo.com>
2018-11-26[FIX] web: list default_sort with multiple fieldsLucas Perais (lpe)
Define a x2m tree view with a default_sort including more than 1 field to order the list against Before this commit, the second field was never used After this commit, it is used OPW 1909785 closes odoo/odoo#28840
2018-10-31[MERGE] forward port branch 11.0 up to a587325ca7aChristophe Simonis
2018-10-31[FIX] web: reload many2one data if the context has changedlen-odoo
When a view is loaded, it checks which fields it has to load. In the case of a many2one, it could be the case that a context key is present in one view and not in the other; if it happens, we should reload the data, as a name_get result could vary. opw 1891295 closes odoo/odoo#28298
2018-10-30[FIX] web: consider correct viewtype when loading dataRémi Rahir
Before this commit, when loading the data and calling the prostprocess, the viewType was not correctly passed which could lead to broken behaviour. For example, if one was to load a record from a list view embedded in a form view, the viewtype passed was the list which prevented to load the data from the form view. OPW 1891295 closes odoo/odoo#28279
2018-10-26[MERGE] forward port branch 11.0 up to e18ed24c07aChristophe Simonis
2018-10-26[FIX] web: typo in docstringYannick Vaucher
The parameter would not be correctly detected by doc extractors closes odoo/odoo#28169
2018-10-19[MERGE] forward port branch 11.0 up to 22a13073f0eChristophe Simonis
2018-10-16[MERGE] forward port branch 11.0 up to b29b545fe84Christophe Simonis
2018-10-09[FIX] web: fetch dependency fields in x2manyLucas Perais (lpe)
Image field widget need the __last_update field alongside them for caching purposes, though that field should never be present explicitly in the views Before this commit, the dependencies of field widgets were not merged into the model's fields definition, creating a traceback when adding an image field widget into a x2many list After this commit, there is no traceback and the image field works properly closes #27545
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-11-22[MERGE] forward port branch saas-11.3 up to b09f624f207Christophe Simonis
2018-11-16[MERGE] forward port branch saas-11.3 up to bab2a191d29Christophe Simonis
2018-11-09[FIX] web: extend the fieldsInfo of a view with the origin view to evaluate ↵Aaron Bohy
extra fields Suppose you are editing a SO to add a new line. Depending on the configuration, a sale order line wizard may open (e.g. if packages are activated). This wizard is a form view, opened from the tree view of the sale order lines. We have commit 8e5156938a9c87b80512bff9ecd025891406e624 that adds extra fields from the originating view. (However it doesn't work if the other view is inlined, so we modify this part to add the extra field even in this case.) Then we need the field info from the origin view in the target view; we do so by extending the former with the content of the latter. opw 1904337 closes odoo/odoo#28441
2018-11-02[MERGE] forward port branch saas-11.4 up to f6ca72b3ce9Christophe Simonis
2018-10-31[MERGE] forward port branch saas-11.3 up to 21eb31d8047Christophe Simonis
2018-10-29[MERGE] forward port branch saas-11.3 up to 6136f0c02e5Christophe Simonis
2018-10-19[MERGE] forward port branch saas-11.3 up to d82a9077289Christophe Simonis
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-12[FIX] web: stabilize sequence for new records on last pageSébastien Theys
Before this commit, the compute sequence was relying on the fact the ID was used as a secondary order key to get the right result. This is necessary when adding items between pages because we don't resequence the following elements. However this was not necessary when adding new elements on the last page since there are no following elements to resesquence in that case. PR: #27639
2018-10-01[IMP] product,(website_)sale: Product configurator default_get cleanupAurélien Warnon
Targets commit d3530eb07e24278117ab396ecb86a59deecc312d Purpose ======= [Follow up AL review] Removed the default_get override in the sale_order_line model. - The default values to create records are now specified by pefixing them with "default_" in the JS. That will use the built-in framework method, which is more simple/clean. - The "list_editable_renderer.js" file for the product configurator was removed and its content is now merged within the SectionAndNoteListRenderer. Updated fields: - [sale_order_line in sale/sale.py] "product_no_variant_attribute_values" to "product_no_variant_attribute_value_ids"
2018-09-26[FIX] web: order read_group by aggregable fields only in list viewXavierDo
The read_group method will ignore and display a warning when giving an order on a non-aggregable field. Therefore, when accessing a list of record from a list view group by some field and ordered on another one, a warning will appear in logs (making the nightly clikall test yellow) The solution here is to only order by current group by field and on aggregable fields. We want to keep the user order to know the ASC/DESC information.
2018-09-25[IMP] framework js: improve X2Many 'CREATE' operation to handle multiple recordsAurélien Warnon
Purpose ======= The 'CREATE' operation lacked the possibility to handle multiple records. The 'context' parameter is now an array of dict that contains the context for each new record. This is usefull when you want to create multiple records into a list in a single call. Please note that the 'default_get' is still called once for each record in an async way.
2018-09-25[IMP] product,(website_)sale: Move product options configurator into sale moduleAurélien Warnon
Task #1871557 Purpose ======= - Configure a product from a sales order as easily as in the ecommerce The backend uses the same template as the frontend to configure a products and its options - Display optionnal products of optionnal products in the "sale options" section - Allow adding exlusions to some combinations of the product and/or to some combinations of the optionnal and accessory products Specification ============= PHASE I 1. Improve the "Add to cart" with optional products - When you add an option to cart, move the product to the cart & show the options of this option - Don't open the option wizard if no option available (in case this module becomes generic, it's better to skip this step when it's not needed) - Display the options right under their related product in the cart 2. Do not allow to add the product as an optional product for itself Why ? - No functional sense - Creates issues in the add to cart wizard 3. Exclude some attribute combinations within the product or with related options and accessory products - Rename VARIANT PRICES button -> CONFIGURE VARIANTS - When you click this button and select a value, open form view rather than inline edition - Form view of variant values: - Attribute - Value - HTML Color Index - Attribute Price Extra - Not Compatible with: o2m tab with 2 fields: Product AND Attribute Value (of this product) [m2m tag selection] - in any new line, autocomplete the current product by default - Tooltip: A list of product and attribute values that you want to exclude for this product's attribue value. Also applies on optionnal and accessory products. 4. New option to configure a product in a sales order line - This option is only visible if the corresponding option is activated in the sales settings - It opens a wizard to select a product template, configure related attribute values and select optional products (based on frontend view) - Attributes not compatible with other selected attributes should not be selectable - Must work like in the frontend
2018-09-25[IMP] web: limit number of open columns in kanban viewsvs-odoo
With this commit, we limit the kanban view to 10 open groups at the start. This is useful to prevent the web client to make too many requests at once. This limit is set in the constant 'OPEN_GROUP_LIMIT'. Note: - columns already set as folded by default aren't take into account. - the user can still open any folded column, as usual. Task #1878113 (1/2)
2018-09-25[FIX] web: improve automatic creation of new lines in x2many in formsVincent Schippefilt
This commit fixes a few issues with the previous implementation of the automatic addition of new lines in x2many inside forms 1. Before this commit, when there is a change of mode in a formview `edit` -> `readonly` -> `edit`, there may be some cases that mistakenly and automatically opens a modal. This case occurs in a form view with a x2many field whose 1st inner focusable element opens a modal (e.g. "Add an item"). In `edit` mode: 1. Open this modal from the x2many 2. Close the modal 3. Change mode to `readonly` 4. Change mode to `edit` > the same modal is automatically open. This is due to the tracking of the last activated field that persists after a change of mode. Since the last activated field in the 1st `edit` is the x2many, it is granted the focus at the beginning of the 2nd `edit`, which automatically opens the modal. This commit fixes the issue by resetting the tracking of the last activated field when there is a change of mode. As a result, at the beginning of the 2nd `edit`, the focus should always be on the 1st field. 2. Before this commit, if the focus was moved out of the form (to a modal for instance) then back, the form would re-activate the last field, which is the x2many and would re-add a new line. This behavior is not correct and now going back from a modal to a form does not add a new line. Co-authored-by: Alexandre Kühn <aku@odoo.com>
2018-09-25[IMP] web: x2many adds a new line by tabbing on a not dirty lineVincent Schippefilt
Before this change, when the focus was on the first field on a x2many field, and the user pressed TAB, the line would be discarded and the focus moved to the next field (at the level of the x2many) in the form. This was an issue because if the first field was required, the focus could not be moved out of the field with TAB so the user had to discard the line manually (with ESC) before moving to the next field This change works with 2 changes: 1. detecting if a line is dirty (has been modified by the user) and at the end of the line, decide to either - discard the line and move the next field, if the line is not dirty - commit the line and add a new line, if the line is dirty 2. allow users to use TAB through required field inside x2many so they can easilly go to the end of the line. Task id : 1872248
2018-09-11[FIX] web: wait for onchanges before savingAaron Bohy
Rev. db9b91ff removes a use of a mutex where it could end up in a deadlock situation (and where the use of the mutex wasn't necessary). However, it caused an issue as the following scenario didn't work anymore: - in a form view with a one2many with fields A and B (required), with an onchange on A setting B, - add a row and set a value for A, - click on 'Save' directly (before the onchange RPC returns) - whereas it should wait for the onchange to return before trying to save, it tries to save directly but faces an unset required field, and displays a warning to the user. The reason is that, before saving, the FormController asks all its widgets to commit their value (through a call to commitChange). This call was, prior to db9b91ff, done in the mutex. The onchange RPC being itself done in that mutex, we thus waited for the onchange to return before calling commitChanges. After db9b91ff, since there was no longer a mutex, commitChanges was called directly, and the editable list returned a warning as one of its required field was unset. This commit ensures that commitChanges is called once all onchange RPCs are done, by waiting the mutex to be idle.
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