summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
AgeCommit message (Collapse)Author
2018-06-08[IMP] web: add decoration support for all field widgets (#25160)oco-odoo
It is sometimes useful to be able to customize slightly the color of a field depending on some conditions on the current record. For example, imagine that we want to show a VAT number field in green/red, if it was validated or not. To do that, we can add a field with an onchange, and simply add decoration-danger and decoration-success attributes to the field.
2018-06-07[MERGE] forward port branch saas-11.3 up to c00df146547Christophe Simonis
2018-06-06[MERGE] forward port branch saas-11.2 up to c834c0f5879Christophe Simonis
2018-06-06[MERGE] forward port branch 11.0 up to e7aff3775fbChristophe Simonis
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-05-30[MERGE] forward port branch saas-11.3 up to 53300648edeChristophe Simonis
2018-05-30[FIX] web: proper rendering of widget tagMathieu Duckerts-Antoine
There was no consideration of the fact that the widget rendering process could be asynchronous. This commit fixes that situation so that render a node of type <widget name="..."> is now possible.
2018-05-29[MERGE] forward port branch saas-11.2 up to a2f275dfc48Christophe Simonis
2018-05-29[MERGE] forward port branch 11.0 up to 4ea3838d895Christophe Simonis
2018-05-29[MERGE] forward port branch saas-11.3 up to 37eed7c509fChristophe Simonis
2018-05-29[IMP] web: correctly handle attributes on non inline viewMartin Geubelle
Before this rev. the `column_invisible` and `default_order` attribute, set in a x2m list view were only taken into account for inline views. The technical reason behind is because non inline views are fetched after the main view processing. Non inline x2m list views now correctly handle these two attributes.
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[MERGE] forward port branch saas-11.2 up to 58e35522468Christophe Simonis
2018-05-23[MERGE] forward port branch 11.0 up to 02ee3fd88efChristophe Simonis
2018-05-23[FIX] web: fetch name_gets on list only when there are dataAlexandre Kühn
Revision on 8ac98fc78a3794e06481b02a431bcdc386a5a6ee The commit above does not check whether the list contains data or not. As a result, if there are no data in the list, there is no reason to fetch `name_gets`. In fact, there could be a traceback because some parameters of this rpc are computed from data in the list. So if there are no data in the list, the parameters of the rpc are undefined. This was the case for a test in enterprise.
2018-05-23[FIX] web: only abandon records on discard without savepointAlexandre Kühn
Revision on https://github.com/odoo/odoo/commit/9a9da5763b38a3bce54e9c4870af0032e38cacc3 The intent of the commit above was to no abandon records in a list on discard when these records have been created from a `default_get`. Also, the `default_get` may also perform an `onchange` that could create more records. The records from this `onchange` must also be included in the "do not abandon" rule. However, the rule was too relax, so that any following `onchanges` from a user interaction was also considered into this rule. As a result, it was not possible to abandon such records. With this fix, we restrict the rule to `default_get` (already the case) and only the `onchange` right after a `default_get`. Any record created on an `onchange` from a user interaction after a `default_get` should be abandoned on discard. Representation of creating the list: savepoint |----------|-----------|-------||--------|-------> create default_get onchange1 onchange2 record in the list is created by default_get or onchange1 => do not abandon on discard record in the list is created by onchange2 => abandon on discard
2018-05-18[FIX] web: show names of many2one on default_getAlexandre Kühn
Before this commit, some records in a list did not show the name of their many2one fields. This case occurs when the records in the list are created from a default_get, and the records do not fit in a single page. In that case, the records in the first page correctly display the names of their many2one fields, but not the records in the other pages. Fixes #24547
2018-05-18[FIX] web: pass unique ids on `name_get` rpcAlexandre Kühn
Before this commit, when a list contains records with many2one fields that contain the same values, duplicate ids were passed to the server on rpc `name_get`. For instance, if 40 records in a list refer to a Unit of Measure with id "1" whose displayed_name is "unit(s)", the server receives a long list of ids with simply the value "1". Also, the server responds with a list of displayed_name, in this case a list of 40 strings "unit(s)". With this commit, we always pass unique ids to the server on rpc `name_get`.
2018-05-17[MERGE] forward port branch saas-11.2 up to 16552029241Christophe Simonis
2018-05-17[MERGE] forward port branch 11.0 up to 59a8a1cd8eeChristophe Simonis
2018-05-16[FIX] web: sort relational fields by their nameslen-odoo
When sorting records according to a many2one field in a list view embedded in a form view, the js would sort according to their ids, in a seemingly arbitrary order. Thus sorting records according to a field with values in ("a", "b", "c") could be sorted as "a", "a", "c", "b" instead of "a", "a", "b", "c". We make the comparison on the name of the field instead. opw 1838860
2018-05-09[MERGE] forward port branch saas-11.2 up to aae54ecc159Christophe Simonis
2018-05-08[MERGE] forward port branch 11.0 up to f2e105eeca4Christophe Simonis
2018-05-08[FIX] web: navigate through records in Kanban with progressbarAaron Bohy
Recently, rev. c0809dd41 removed a protection in the reload of Kanban views with progressbars. This protection ensured that the manual reload of the progressbars was only done when one of the records of the Kanban view was updated (and not when a column, or the whole view was). However, removing it highlighted a bug linked to the manual reload of progressbars, which messed up the list of ids in the environment. As a consequence, for instance, if the user archived the records of a column, and then opendc a record in form view, it couldn't use the pager anymore. Besides fixing this bug, this rev. re-introduces the protection, and refines it to prevent 2 useless RPCs when the whole Kanban view was reloaded. opw~1841276 opw~1841342
2018-05-04[MERGE] forward port branch 11.0 up to 8dade01e2c5Christophe Simonis
2018-05-04[FIX] web: one2many form view with action buttonAaron Bohy
Assume a one2many field inside a form, displaying field A in its list view, and a field B in its (dialog) form view. Moreover, there is an action button in the dialog, which updates the value of B. Before this rev., B wasn't correctly reloaded when the button was clicked, because the BasicModel reloaded the fields on the list view (i.e. field A), whereas it should reload the fields in both views. This fix is twofold. First, we force the viewType to 'form' when the record is reloaded, instead of the default ('list'), so that fields in the form view are correctly reloaded. Second, when we open the form view in the dialog, we add the fields of the list view to the dict of fields of the form view, so that the form is aware of those fields and can ask the model to reload them (still without displaying them). Fixes #24189
2018-05-03[MERGE] forward port branch 11.0 up to c591e0de7d1Christophe Simonis
2018-05-03[FIX] web: inline views should share their fieldsNicolas Martinelli
This causes issues (already 3, and counting...) This reverts commit 27c9f838d35f36f6fe8d68068ed96c5c58d9d186. opw-1840984 opw-1841041 opw-1841000
2018-05-02[MERGE] forward port branch 11.0 up to 521414b1c10Christophe Simonis
2018-05-02[FIX] web: inline views should share their fieldsLucas Perais (lpe)
Have a One2Many The views of that o2m define two inline views: the list and the form in the list view, put a field that isn't in the form and used in a domain Try to add an item to the list The form pops up Fill in the data and save & close Before this commit: It crashed when evaluating the domain on a field using the field that is not in the form After this commit: Subviews share their fields in a special object on the parent record In our case, the form view checks in that shared resource if the fields it is supposed to initialize are there. Hence, this flow doesn't crash anymore OPW 1837511 closes #24350
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-25[FIX] web: BasicRenderer: button's name attr in DOMAaron Bohy
Rev. 374af56 changed the way 'button' nodes are rendered in basic views (form, list, kanban). As a consequence, their 'name' attribute wasn't transmitted to the produced html elements anymore. However, this attribute is very convenient to debug views, and to write selectors in tests. For instance, it broke the test added by rev. 8d17a2a once forwardported in master. This commit reverts 1ce5bea.
2018-04-25[FIX] web: fix crash keyboard related crash in graph viewVincent Schippefilt
Before this fix, when going on the graph view from the dashboard view ( using the fullscreen button on dashboard), the focus is on the search input, hitting the tab key creates a crash. This fix gives a default implementation of giveFocus to the abstractrenderer so there is no crash.
2018-04-24[MERGE] forward port branch saas-11.3 up to ec5e27bb7ccChristophe Simonis
2018-04-23[MERGE] forward port branch saas-11.2 up to 7113b70762dChristophe Simonis
2018-04-23[MERGE] forward port branch 11.0 up to 3ab25b60bc5Christophe Simonis
2018-04-23[FIX] web: handle nested x2m default valuesChristopher Ormaza
The initial rev. odoo/odoo@2d3ecf2 that was supposed to handle this use case was in fact only dealing with one command as default value for nested x2m, not more. The basic model can now handle multiple commands. Closes #24241
2018-04-19[DOC] web: add documentation on notification systemGéry Debongnie
Also, fix a few errors in the js docstring
2018-04-19[FIX] web: do not change pager when discarding changesGéry Debongnie
Here is a scenario that could happen before this commit: 1. go to a list view with more than one record, say 3 2. click on the 3rd record to open the form view 3. the pager says 3/3 4. click on edit button 5. click on discard button 6. the pager says 1/3 (but the record displayed is still the same) It is often necessary to restore the offset for the sub records, because the number of pages in a one2many could have changed. However, it is not a good idea to do that for the main record, since it interferes with the usual flow of operations.
2018-04-19[MERGE] forward port branch saas-11.3 up to 204935119d1Christophe Simonis
2018-04-18[MERGE] forward port branch saas-11.2 up to fed775bc0c2Christophe Simonis
2018-04-18[MERGE] forward port branch 11.0 up to 8c64159b884Christophe Simonis
2018-04-18[REF] web: review button renderingqsm-odoo
Button rendering was most of the time wrong, incomplete or performed with duplicated code. This led to: - Both primary and default classes were put on some statusbar buttons - Icons were not able to be put for statusbar buttons - Stat buttons and list buttons code were duplicated - Classes and style were added twice - ...
2018-04-17[FIX] web: handle x2m commands with reference as defaultMartin Geubelle
Before this rev. it was not possible to define a value for a reference field in x2m commands as default value. Courtesy of @kaerdsar. Closes #24070
2018-04-16[MERGE] forward port branch saas-11.2 up to 90f8f17fb4fChristophe Simonis
2018-04-16[MERGE] forward port branch 11.0 up to ad825b673b5Christophe Simonis
2018-04-13[FIX] web: BasicModel: default_get on o2m with date fieldAaron Bohy
Before this rev., a crash occured when a default_get returned a command 0 (CREATE) for a one2many, with a value for a date(time) field (e.g. [0, false, {some_date_field: '2018-12-08'}]). This was because the related values (inside the commands) weren't parsed. This only impacted date and datetime fields, for which the parsing converts the string into a moment instance. Fixes #23672
2018-04-13[FIX] web: o2m list with field datetime from serverLucas Perais (lpe)
Have the create_date field displays on a one2many list Try to add a record onto the list Before this commit, when the virtual record is added onto the list it crashes because the datetime field is undefined and cannot be parsed After this commit, It doesn't crash though the value would have to wait the save on the main record to be updated (because it is the create_date) OPW 1834250 closes #24097
2018-04-12[FIX] web: update column in grouped kanbanMartin Geubelle
In a kanban grouped by many2one with a progressbar, after emptying a column by moving all records, the column wasn't correctly updated. This was causing, in the best case, a record duplication or, in the worst case, a traceback. This issue comes from the fact that, with a progressbar, a read_group is performed each time a record is moved. When the group (column) becomes empty, the read_group won't return this group even though the group still appears in the kankan. When moving back the record in this empty column, there is a desynchronization between the kanban controller data and the model. To fix this issue, an option `keepEmptyGroups` is passed when performing the mentioned read_group ; this mimics the kanban display that keeps empty groups displayed and there is no desync anymore. Fixes #23982