summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/basic
AgeCommit message (Collapse)Author
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-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
2018-04-11[REF] web: remove updateModifiersValue from widgetGéry Debongnie
The keyboard shortcut branch recently added a method updateModifiersValue on the widget class, which is used to make a widget aware of its modifier status (in particular, if it is required). This is necessary for the proper navigation behaviour on field widgets, but should not be on the widget class. The proper fix is, in my opinion, to introduce a AbstractViewWidget class which would be used for AbstractField and all custom widgets in views. Meanwhile, this commit simply protects the call to that method. This is a refactoring, but can be merged in saas-11.3.
2018-04-10[IMP] web: keyboard navigation in form viewVincent Schippefilt
1. Added the ability to navigate within the List view using UP and DOWN keys. 2. By defaults, the focus should be set on the search input field. 3. From the search input field, using the DOWN key, the focus goes to the list 4. From the search input field, using TAB key, the focus goes to the create button 5. From the create/import buttons, using TAB or DOWN key goes to the first row of the list, then UP and DOWN keys moves the focus from item to item in the list. 6. When on a row, hitting ENTER opens the view of that row. Also in this commit 1. When on the first row, hitting the UP key does nothing 2. When on the last row, hitting the DOWN key does nothing Not included in this commit 1. Memorize the position on the list when opening an row, than restoring when going back to that list 2. Navigation on grouped list using the keyboard
2018-04-10[IMP] web: keyboard navigation in form viewVincent Schippefilt
The goal of this commit is to allow fast entry of the same model using the keyboard for navigating through the form once, by blocking the user from advancing in the form if there is a required field or once they went through the form once to get them to a primary action (button) This commit includes the following changes 1) Enable moving forward from field to field using the TAB key 2) Entering the one to many and many to many using the TAB key a. When entering it, set the focus on the "add new line" link or button b. When adding a new line, set the focus on the field visible editable field of the new line c. Discard adding a new line with ESC key d. If the user leaves the first field empty and uses TAB, we will cancel the adding of a new line and move to the next field of the form 3) When a field is required and not filled in, do not allow the user to move out of the field using the TAB key (the user is still allowed to use the mouse though), mark the field as invalid instead 4) After going though the form once, using the TAB key on the last field will move the focus to the first primary button of the page 5) When the focus is on a primary button (EDIT/SAVE), the user cannot move the focus forward using the TAB key. Hitting TAB again will display a tooltip telling to hit ENTER to activate the button. The mouse is still available to move the focus. 6) When the user saves, the focus is placed on the first primary button of the form renderer (like VALIDATE for a new invoice) 7) On dialogs, primary buttons should stop the users from moving out of them, and showing a popup if the user tries 8) When closing a dialog, the focus will be moved back to the widget that opened it. This commit does not include the following features 1) Navigation with the keyboard on a selection one to man 2) Navigate between tabs in a form using the keyboard 3) Cancelling the adding of a new line in a many to many using the ESC key do not set the focus correctly 4) Enhancing the focusses fields (like blue underline)
2018-04-06[MERGE] forward port branch 11.0 up to d277adf4d59Christophe Simonis
2018-04-05[FIX] web: no record abandon on discard from default_get/onchangeAlexandre Kühn
Before this commit, when some records were created from an `onchange`, we have the following weird behaviour: Suppose that this record has some required fields that are empty. When we click on this record, then somewhere else, the record disappears from the list. This is because the records contains invalid fields, and it is wrongfully assuming that the record to be discarded comes from "Add an item". A previous commit [1] fixed a bit this issue with `default_get`, but since it relied on a fragile heuristic, we decide to apply the correct fix with this commit. [1] https://github.com/odoo/odoo/commit/b09f0c99be2b13d33986414485556d87da186d65
2018-04-05[FIX] web: loss of context when duplicatingNicolas Martinelli
- Create a vendor bill, save and validate - Duplicate the bill, save - Click on "Create" A customer invoice is created, while the user expects a vendor bill. After duplication, the new record is loaded but the context is lost. Since the default value for the invoice type is based on the context key `type`, a loss of context leads to an incorrect invoice type. opw-1826453 Co-authored-by: Géry Debongnie <ged@odoo.com>
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-04-03[REF] web: BasicView: allow overriding arch parsingAaron Bohy
This rev. refactors the way the view's arch is parsed in BasicView, so that it can be extended specifications of the BasicView to handle other tagnames that 'field' (which is basically the only one handled in BasicView).
2018-03-28[FIX] web: correctly display reference field in subviewLucas Perais (lpe)
Have a form view with a O2M. The model at the 'many' end has a reference field Have a record of the second model display in a modal (by clicking on a record in the o2m list) Before this commit: The field reference was not filled up This was because the fields to fetch on the modal creation weren't correctly set. Obvisouly, it also created problem when trying to change the record on the modal: spawning tracebacks because the reference field was not present in the local datas After this commit: The display of the reference field is as expected both in the original form and in the modal OPW 1829822 closes #22468 closes #23896
2018-03-23[MERGE] forward port branch saas-11.2 up to 8a7b8453531Christophe Simonis
2018-03-22[MERGE] forward port branch 11.0 up to 39d9c362c5bChristophe Simonis
2018-03-22[FIX] web: don't loose focus when editing cell in listLucas Perais (lpe)
Have a list with readonly modifiers on at least one column. Have the first record of the list be readonly as computed by the modifier Create and edit a second record Enter a value in the cell and hit TAB Before this commit: The focus on the targetted cell was lost and the rendering of the cell was in mode readonly This was because the baseMode of the modifier dict was applied to one and only one node (== one column) and hence to *all* the records After this commit: The rendering and keyboard TAB navigation works as expected in the list editable The baseMode concept has been sharpened and each cell now has one OPW-1816569 OPW-1824979 closes #23809 closes #22859 closes #23436
2018-03-21[MERGE] forward port branch saas-11.2 up to 500e3f49705Christophe Simonis
2018-03-20[MERGE] forward port branch 11.0 up to 2835d299792Christophe Simonis
2018-03-15[FIX] web: add many records in m2m listLucas Perais (lpe)
Have a model with a m2m (field A) this m2m has also a m2m (and displayed as m2m tags in the view) (field AA) Have a domain on field A, to trigger the search view selection Click on add an item Select everything in the modal, making sure that there is more than 40 records Click on Select Before this commit: There was a traceback indicating the local data did not contain records >= 40 This was because the internal data repository was constrained by a limit After this commit: We adapt the limit of the local data repository and there is not traceback OPW 1823400
2018-03-14[FIX] web: x2m: properly reset limit/offset to initial valueGéry Debongnie
When we discard an element, we want to make sure that the new state is not corrupted by previous user operations. In our case, we possibly had a limit and an offset values modified by the user. This could lead to unpleasant situations, with incorrect data displayed on the form view. Note that this actually fixes a new bug introduced by commit https://github.com/odoo/odoo/commit/e7fab234201e357da52c3576ad2e8fc9ceee9359 (this is the commit that introduces the tempLimitIncrement attribute)
2018-03-12[FIX] web: better experience for one2many edition (paged)Géry Debongnie
A big problem with the o2m edition happens when the user has a full page (so, in general, 40 records) and click on add. If the o2m is in editable="bottom" mode (which is actually a really common usecase), then the next record will be added at the end. However, since we have a limit of 40, it will immediately go to the next page. The effect is even weirder when there is a required field in the tree view. In that case, the new record appears correctly, the user can edit it, then, as soon as the required fields are set, it will immediately disappear from the current screen. In this commit, we have a really simple solution: we simply increase the limit in this case. An interesting thing is that it is actually temporary: when the user goes to the next page, the limit is back to its original value (due to the pager click: it resets the value to what the pager knows).
2018-03-10[FIX] web: scroll to top when using the pagerAaron Bohy
In multi pages list view, the scroll position is reset to top when the user switches between pages. This wasn't working if he first reset the limit, and then switched between pages.
2018-03-10[IMP] web: restore scroll positionAaron Bohy
This rev. improves the way the scroll position is restored when coming back to a view (e.g. open a kanban view, scroll, click on a record to open it in a form view, go back to kanban using the breadcrumbs): - generalize the scroll position handling from web_enterprise to web to make it available in the community webclient as well - also restore left scroll position, not only top (especially useful for grouped Kanban views with a lot of columns) - handle the case where the scrolling area is a sub element of the view (e.g. the grouped Kanban view in mobile). Task 34037 Co-authored-by: Mohammed Shekha <msh@openerp.com> Co-authored-by: Ankit Sathvara <asa@odoo.com>
2018-03-09[MERGE] forward port branch saas-11.2 up to 42659dc70c2Christophe Simonis
2018-03-08[MERGE] forward port branch 11.0 up to fcb48b72415Christophe Simonis
2018-03-08[FIX] web: add the node attribute to the form view widgetGéry Debongnie
This could (should?) be considered a refactoring, but this is actually trying to restore lost functionality. In v10, the custom form widgets were created with access to the node element that define them. We lost that in v11, with the new views. However, it is actually very useful for generic widgets. Since this is not really a risky fix, I think that it can be done in 11.0. Note: this feature was already reintroduced in master in commit https://github.com/odoo/odoo/commit/b7aa439826df6b3e442b3f60bb593ff28efc8679
2018-03-08[MERGE] forward port branch 11.0 up to bfe88c50e2bChristophe Simonis
2018-03-08[FIX] web,mail: always reload widget mail_activityAaron Bohy
Before this rev., the field widget 'mail_activity' kept an internal cache of fetched activities (like the 'mail_thread' and 'mail_followers'). However, for activities, this cache may cause issues. For instance, create a new lead in 'My pipeline', schedule a 'Meeting' activity on that lead (it opens the Calendar view so that real meetings can be created), create a meeting 2 weeks from now, go back to the lead form view: the activity still diplays that the meeting is today (when the view is refreshed, the correct date is displayed). This rev. removes the internal cache for this field widget, as the activities can easily be updated in business flows (unlike messages or followers). This rev. also fixes a bug in the BasicModel, where the res_ids of a list datapoint was altered in place to return a list of x2many commands instead of the list of ids when being stringified. This caused a traceback when opening a lead with activities, as soon as the internal cache had been removed.
2018-03-06[FIX] web: BasicView: prevent crash in testsAaron Bohy
A crash occured in several Studio tests that have just been forwardported to saas-11.2, because of a line that hadn't been adapted in rev. cb339842 (technically, the previous code was correct, but it crashed when viewInfo.fields was undefined, which doesn't happen outside the tests environment).
2018-03-05[IMP] web: Add an Item --> Add a Line in One2manyList (item is weird for ↵Fabien Pinckaers
some objects- )
2018-03-05[FIX] web : remove useless reload of failed _callButtonActionVincent Schippefilt
Before this fix, when a _callButtonAction failed, it would reload the model. After this fix we will not reload if a _callButtonAction fails
2018-03-01[MERGE] forward port branch 11.0 up to c2e878e34c8Christophe Simonis
2018-03-01[FIX] web: prevent footer from being rerenderedGéry Debongnie
In some cases, the footer in a form view dialog could be duplicated. The reason was that the form view was rerendered completely, footer included, by the renderer, out of the formcontroller control (it is the formcontroller's job to move the footer buttons to the footer). A possible fix is to work on the form renderer to make it aware that the footer buttons are expected to be only rendered once, but it has the disadvantage to be a fix specific to this issue, and any other form view behaviour with some side effects may have the same issue. This commit tries to prevent the form view from rerendering itself completely in those cases. This also has the disadvantage of possibly not being a complete fix, if some edge cases are missed. However, I have the feeling that we still want to avoid rerendering the full view if possible.
2018-02-26[FIX] web: default_get returning unknown fieldAaron Bohy
Before this rev., it crashed when trying to create records of the res.users model. This is due to commit ad1cceb. The 'default_get' of 'res.users' always returns a value for field 'groups_id', whereas the docstring of 'default_get' states that it only returns default values for fields given in arguments. Rev. ad1cceb changed a bit the way the result of 'default_get' was processed, by iterating over the values instead of over the fields in the view. So, before ad1cceb, 'groups_id' was simply ignored, and after, the BasicModel tried to process it and it crashed when it attempted to retrieve its fieldsInfo, as this field isn't in the view. This rev. restores the previous behavior. Fixes #23303 Fixes #23305
2018-02-26[FIX] web: multi pages ordered o2m with onchangeAaron Bohy
Let's assume a one2many displayed over several pages with a default order such that a record, say R, that would normally be on page 1 is actually on another page. Moreover, there is an onchange on that one2many which converts all commands 4 (LINK_TO) into commands 1 (UPDATE), which is standard in the ORM. When the first line of the one2many was edited, the record R was fully loaded, whereas it shouldn't have been (as it is not on the current page). So basically, a useless read was performed. Moreover, if there was an x2many field in the one2many list, a crash occurred because relational data of R that shouldn't have been read wasn't postprocessed by the BasicModel. The useless read occurred because the one2many subrecords weren't correctly sorted before checking if some of them/some of their fields should be read. This is not the case anymore. OPW-1816800
2018-02-23[MERGE] forward port branch saas-11.2 up to 932e641be17Christophe Simonis
2018-02-23[FIX] web: one2many and onchange corner case issueAaron Bohy
Let's assume a one2many list view inside a form view, displaying a single char field A. There is an onchange on the form view returning a command 0 (CREATE) for the one2many. The command 0 only specifies a value for field A. The one2many list isn't editable, so when a sub-record is clicked, it is open in a form view (in a dialog). In this form view, an x2many field B is displayed in a sub list or kanban view. Before this rev., it crashed when the user tried to open the created one2many sub-record (returned by the onchange) in the form view, because of the presence of the x2many field B, which wasn't correctly processed by the BasicModel (its value was undefined, whereas it must be a valid, empty, dataPoint). Moreover, the limit of the x2many field B wasn't set, so a pager was displayed as soon as it contained at least one record. Fixes #22050
2018-02-22[MERGE] forward port branch saas-11.1 up to e750bb6e114Christophe Simonis
2018-02-21[MERGE] forward port branch 11.0 up to dbb713c2f83Christophe Simonis
2018-02-16[FIX] web: BasicModel: onchange on X2M: handle command 6Aaron Bohy
Before this rev., when an onchange returned a command 6 for an x2many field, it was completely ignored by the BasicModel.
2018-02-16[FIX] web: BasicModel: fetch nested x2manys after onchangeAaron Bohy
When onchange RPCs return a command 4 (LINK TO), the res_id of the record to link is given, and the BasicModel has to read the fields in the view for that record. When one of those fields is an x2many (for instance, displayed with widget many2many_tags), the subrecords in the relation must be read as well (at least their display_name). Before this rev., this last part wasn't done by the BasicModel, and as a consequence, the many2many_tags widget was always empty, even though there were records in the relation. Same thing applied to reference fields, but this is way more uncommon. This rev. ensures that x2manys and reference fields are correctly fetched in this scenario.
2018-02-16[FIX] web: discard new record with empty required fieldAlexandre Kühn
Before this commit, there is an issue with one2many lists with records that have been created on 'default_get': if the record has a required field that is empty, when the user clicks on this empty required field and then somewhere else, the record is removed from the list. The cause of this bug is that these records have invalid field changes, here the required field that is empty. As a consequence, it checks whether the record is "new", and if so, removes it visually from the editable list. (Note: a record is "new" when it is not stored in DB). This behaviour is expected when discarding records created from "Add an item". However, that is not intended for records that have been created as default items of the list. These records are still considered as "new" items, because they are not stored in DB, but they should stay in the list on discard. This commit solves the issue by making an additional check before assuming that the record for which we discard changes comes from "Add an item": if the record in the list has been created before user interacts on the list (in other words, the record has been added in the list when the user accesses it), then we should not remove the record from the list, even though the record has some invalid fields from the savepoint (e.g. empty required). opw-806650
2018-02-12[MERGE] forward port branch saas-11.2 up to 0f02dcb6391Christophe Simonis
2018-02-12[MERGE] forward port branch saas-11.1 up to c69d00157edChristophe Simonis
2018-02-12[MERGE] forward port branch 11.0 up to 169f899e291Christophe Simonis
2018-02-12[FIX] web: update form widgets when state has changedGéry Debongnie
Since the <widget> tag is not used anymore in any of our views, it was not really properly supported. In particular, the form widget was not notified when the state of the form view has changed, which makes it very difficult to actually do any useful work. With this commit, we make sure that the widget method 'updateState' (if it exists) is called with the new state whenever it changed. This should allow developers to do useful work without having to work around the issue. Note that this is not really a perfect solution, since the updateState methot may or may not have been implemented. I think that we need some kind of ViewWidget abstraction, which could be used to have a better and more complete API for widgets in a basic view. And AbstractField could inherit from ViewWidget.