summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
AgeCommit message (Collapse)Author
2020-10-22[FIX] web: keep new widget el in ComponentAdapterMichael Mattiello (mcm)
Before this commit, when sub widget replaced its el, the ComponentAdapter parent kept the previous el. This caused some issues as in the ActivityRecordAdapter which lost its event listeners when re-rendered. This commit forces the ComponentAdapter to keep the new sub widget el after being patched. task id: 2360021 closes odoo/odoo#60517 X-original-commit: 393b5fd4cfba254ad054a526996e82922f9057e2 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com>
2020-10-16[FIX] web, doc: remaining_days widgetNicolas Martinelli
The `remaining_days` widget is intended to be used for informative purpose, hence it should not be editable. opw-2362276
2020-10-19[FIX] web: raise Warning triggers a tracebackJulien Castiaux
Create a Server Action with the following code: `raise Warning("")`, when the SA is executed it opens the crash manager with a traceback instead of the user error modal. The `odooExceptionTitleMap` data structure lists all Odoo exceptions that descend from UserError, this structure is used within the `rpc_error` function to filter pure Python exceptions from custom Odoo ones. opw-2365689 closes odoo/odoo#60248 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
2020-10-19[FIX] web: correct count of dayMartin Trigaux
Introduced at 2f67881d4517b78 Taken an event with start_date: 2020-10-01 stop_date: 2020-10-02 allday: True The date was displayed as "01/10 - 03/10 (2 days)" instead of "01/10 - 02/10 (2 days)" closes odoo/odoo#60062 X-original-commit: 68774135ad827ff4d9fc678ce8e839a717459623 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-10-15[FIX] web: calendar widget has undefined attrsnie
Backport of #59876 closes odoo/odoo#60124 X-original-commit: 5d4ae907934b90dda4ac9fb3b5080e632b677219 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Signed-off-by: backspac <backspac@users.noreply.github.com>
2020-09-28[FIX] sale_timesheet, web: disable autofocus on create invoce actionKamesh Patel
Before this commit: The date range widget opened by default when the 'create invoices' the wizard is opened. because the default focus is 'Timesheets Period' field. After this commit: Disable autofocus on 'create invoice' action, after this changes The date range widget is not opened by default when the 'create invoices' the wizard is opened. Task-2344289 closes odoo/odoo#58676 Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-10-14[FIX] web: fetching reference fields' name_get batched in grouped listLucas Perais (lpe)
Commit e10fd34682a0c55568cba66eb271b3aa5bed7c1d introduced batched reference fields name_gets across groups but was also buggy as follows: Have a grouped list view showing at least 2 groups Have a reference field with different values showed in the list for each record Before this commit, the name_get of those reference fiels were fetched only for the last group After this commit, the name_get are fetched in a batched fashion (by model) for each group and display correctly closes odoo/odoo#59903 X-original-commit: bbb608a1eff638040f0fc7b951fedf1579cc15b2 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-10-13[FIX] web: Find key in stringified JSONnie
Steps to reproduce the bug: - In Projects, switch to the calendar view - Click a task Bug: Traceback here: https://github.com/odoo/odoo/blob/7ba47e7215df69b6556a848532e4f33ef4243e83/addons/web/static/src/js/fields/basic_fields.js#L2181 TypeError: Cannot use 'in' operator to search for 'invisible' in {} Explanation: We could change the inherited model of CalendarView from AbstractView to BasicView but it would be adding 400 lines of code to every calendar view. So, for now, and to keep it simple, we just parse the modifiers where it's needed to. opw:2352436 opw:2352890 opw:2354039 closes odoo/odoo#59867 X-original-commit: 422c52a0823b1a53eeb974e76d08a44cacf4ea0a Signed-off-by: backspac <backspac@users.noreply.github.com> Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-09[FIX] web: report controller in multi-companyNicolas Martinelli
- Create 2 companies A & B - Set a website on company A - Switch to company B - Open a done MO - Open the cost analysis An AccessError is displayed. The error arises in: https://github.com/odoo/enterprise/blob/923cbffe4e60572a5c17ee962d571c037e9cff44/mrp_account_enterprise/reports/mrp_cost_structure.py#L90 The root cause is coming from the call to `/report/html/`, which is called without any `data`. In this situation, the following adds an incorrect `allowed_company_ids` in the context: https://github.com/odoo/odoo/blob/d1413a2f06bcb44b1fbb6dba8658e698c8da4018/addons/website/models/ir_http.py#L196-L205 Indeed, the `allowed_company_ids` is the one from the website, in this case company A. The issue doesn't occur when downloading a PDF from the interface since in this case the `data` dictionary contains the appropriate context which is set in: https://github.com/odoo/odoo/blob/d1413a2f06bcb44b1fbb6dba8658e698c8da4018/addons/web/controllers/main.py#L1958 As a solution, we add the `user_context` in the `/report/html` route. opw-2341747 closes odoo/odoo#59654 X-original-commit: 932e347a90bfd4bf025e4e8e54ef9c66cc49c5d0 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-10-06[FIX] web: hide action button when no actionPriyanka Kakadiya
Before this commit: the action menu registry items were rendered regardless of their inner state. The problem is that these item components can choose not to render themselves, leading to a blank dropdown menu if no other item was present. To fix this, the "getProps" function of the registry has been altered to act as validation: the item will not be rendered if the return value is falsy. The function has also been made asynchronous to allow RPC calls. This solution is still flawed and hides a bad design choice which is to register components and not items or item getters; this API is too complex for its use case(s) and adds pointless depth to the DOM. The shape of the registry should be simplified in an improvement in master. closes odoo/odoo#59254 Task: 2325587 X-original-commit: 45c7d881a5d130f6b3222749c8c87b6c6b45e910 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-10-06[FIX] web: Disables pager on enterJulien Mougenot
Before this commit, the pager component would only quit the edit mode if its value changed when hitting Enter. Now, when pressing Enter while the pager value did not change, it will leave the edit mode and trigger a "pager-changed" event regardless. Task 2318738 closes odoo/odoo#59277 X-original-commit: a3197283d52bfda399ce45b7d5a52406885336d0 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-06[FIX] web: send utc date to server from daterange widgetPriyanka Kakadiya
When manually updating the time on a daterange widget, the value sent to the server is not converted to UTC and is sent as it appears on the input. currently daterange widget send datetime value as it is, written in input field if manually entered, so if user set 10:00:00 so while sending data it will be send as it is 10:00:00 so when next time record reloaded after save, it will display 15:30:00 if timezone UTC+5:30. Instead, change the string date to moment object with current user timezone. so that datetime send to server is UTC time and when next time it is loaded it adds user timezone difference, so if timezone is UTC+5:30 and user enters 10:00:00 then while sending data to server it sends 04:30:00 and when displayed again after reload it adds +5:30 timezone difference. LINKS PR #50132 Task 2240378 closes odoo/odoo#59208 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-06[FIX] web: do not allow to edit priority field if readonlyMohammed Shekha
if readonly attribute is given on priority widget then priority widget should not be clickable and hover effect should be removed so that user can easily understand that field is readonly. task-2339680 closes odoo/odoo#59189 X-original-commit: 53dbfc7a65a8eb2f41d6b2373cf628c4800d1f57 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-06[FIX] web: load_filters in search dialogsPaul Morelle
Since fbf347498f1cc7b74ef373179b7bcae201715c24, when opening a view in a dialog, the favorite filters were not loaded. For example on the runbot: 1. In CRM, open any lead, edit it, and open the Customer dropdown 2. Create a custom filter, save it as favorite, and close the dialog 3. Open the dialog again: you don't see your new filter With this commit, you will see your filter at step nr. 3 closes odoo/odoo#59180 X-original-commit: 418013e8dbb2aa2d4ffd4f650f080ca5a94183f9 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Paul Morelle <madprog@users.noreply.github.com>
2020-10-02[FIX] web: reference field calls name_createSimon Genin (ges)
An older commit (50bf8309) had refactor part of the basic field _applyX2ManyOperations. During this refactor, the reference field was forgotten to be included in a condition that made the field no longer do the quick create behavior. The name_create function in the backend was no longer called. Adds a test for the reference field checking the call to the name_create function and fixes the problem. Task id 2322048 closes odoo/odoo#59013 X-original-commit: e7d4baa3d52dc73c9631365801fbe41a4d54e3a1 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-10-02[FIX] kanban: adding context when editing columnJorge Pinna Puissant
Before this commit, when editing a column in a kanban view, in project for instance, the translations weren't loaded. Now, the translations are correctly loaded. opw-2340125 closes odoo/odoo#58981 X-original-commit: e95ed1253817beccb76d1fbd55b1318b3d65cfe5 Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2020-09-28[FIX] web: skip map views and increase timeout in click_allChristophe Monniez
During the click_everywhere test, the map views are tested but leads to random failures when the view takes too long to load. Moreover, the map resources are queried on external nominatim.org servers. This could lead in the test runner being black-listed by nominatim and more indeterminism as those servers are not under our control. For those reasons, this commit will skip the map views in the click_everywhere test. Also, the general time limit is increased. Five seconds was sometimes too short, depending on external conditions (e.g.: server load or screencast enabled). Finally, on a database with all apps installed, the `Settings` menu of some apps loads the full settings and it can takes a huge amount of time to load on a clean browser (as in the tests). For that reason, the time limit for the test of those menus was also increased. closes odoo/odoo#58749 X-original-commit: 2f3ea94a46fde9870db6b6b1d6a4233aaff805ce Signed-off-by: Xavier Dollé (xdo) <xdo@odoo.com> Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2020-09-25[FIX] web, web_editor: fix scroll to hidden dropped snippetsBenjamin Vray
Fix the scroll when the snippet is the dynamic one because it did not work as we tried to get the offset of an element with the d-none class. Remove the scrollValue variable because we don't need it anymore. It was used before the code was reviewed in a previous commit. task-2312878 closes odoo/odoo#58486 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-09-24[FIX] web: Props validationJulien Mougenot
Established the proper props validation on the search panel component. closes odoo/odoo#58436 Related: odoo/enterprise#13513 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-24[FIX] web: Get correctly focusable elements on selection widgetsLuis González
When navigating fields using the keyboard, it's not possible to reach most of widgets for selection fields. That is because most of them consist of one main element containing several other ones, one per possible selectable value (e.g. buttons). When their focusable element is computed, the main element is taken, instead of its sub-elements, which causes the field to be skipped when navigating. This commit fixes the above, as well as some missing aria attributes and keyboard events, for the following widgets: - `priority` - `state_selection` - `statusbar` - `radio` opw-231112 closes #58302 closes odoo/odoo#58418 X-original-commit: 2471e7c176c5df0f310f2939f8a6cf6948c0ac0c Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-09-24[FIX] website, *: review modal behaviors with right-panelizationqsm-odoo
*: web, web_editor Since the right-panelization made with [1], the modals were not compensating the body scrollbar when opened anymore and the backdrop was misplaced. This commit fixes the problems generically, to support modals with non-body scrolling. [1]: https://github.com/odoo/odoo/pull/57975 closes odoo/odoo#58414 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2020-09-23[FIX] web: properly compute popover positionSébastien Theys
- avoid updating default position list in place - ensure computed position takes into account enough margin with border - fallback to requested position instead of bottom Part of task-2270731 closes odoo/odoo#58368 X-original-commit: 3fad17421518732db2085c3eec596600cfe34f03 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com> Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-09-23[FIX] web, mail: recompute popover on content changeSébastien Theys
Because the position of the popover depends on the size of its content. Part of task-2270731 X-original-commit: 3066a946ef1ca0973503207d0486515798168fa2
2020-09-22[IMP] website, *: move page scrollbar to #wrapwrapqsm-odoo
*: web, web_editor, portal, account, website_blog, website_forum This is probably not ideal to move the scrolling behavior out of the html element but this will be needed for the editor to not have a double scrollbar on the right. This is actually also useful for the scrollbar to appear under the purple odoo menu instead of its right. This commit, if to be reverted in the future, however contains many improvements to make the transition easier that should be kept: jQuery and Odoo functions to be able to scrollTo a specific element, get the top scrollable element, check if an element is scrollable, etc. Also, some magic was done: if some code tries to scroll to a specific scroll position via jQuery's scrollTop or animate functions on the html/body element, those will still work as intended (obviously, using the new utils to do that is however recommended). This commit also reviews our scroll behaviors to make them more robust and share the code. Part of https://github.com/odoo/odoo/pull/57975 task-2344227
2020-09-17[FIX] web: handle concurrent actions at startupAaron Bohy
This commit aims at fixing a random bug on the runbot. When loading the webclient, if there is no hash, a rpc is done to read the default action of the user. When this rpc comes back, we execute the given action (if any), or the first action (typically Discuss). The navbar is displayed as soon as possible, it doesn't wait for the first action to be executed. This means that the user can open the user menu and click on 'My Profile' before the first action is executed. Before this commit, if the user clicked before the read rpc on 'res.users' returned, the default action (or the first) one, was executed, even though the user clicked on 'My Profile' and thus asked for a specific action. So basically, the user form view was briefly shown, and then replaced by the default or first action. Whereas this is a very rare usecase in practice (the timing is really short), this sometimes made the totp tour fail. However, even if it is unlikely, the client must be robust and correctly react to concurrent requests. This commit fixes the issue by executing the 'My Profile' action in the DropPrevious. That way, if any 'doAction' is performed, other pending operations (also done in DropPrevious) are dropped. This commit also ensures that the "brand name" part in the navbar (containing the name of the current app) is hidden when there is no current app, as in the scenario described above, we land in a webclient with no current app. Note that not being in an app was something that was already handled, but not at startup. closes odoo/odoo#57840 Related: odoo/enterprise#13277 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-09-16[FIX] web: prevent dropdown closing on mouseupHardik Prajapati
Before this commit, selecting the whole content of the custom filter input and releasing the cursor outside of the dropdown closed the dropdown. With this commit, the dropdown is kept open in this situation. task - 2276544 closes odoo/odoo#55660 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-09-15[FIX] web: list: call mounted on subcomponents at reloadAaron Bohy
Issue was spotted in list views containing the "badge" widget with decorations (e.g. in the Purchase Order list view). At first, the decorations were correctly applied, but they weren't anymore after a reload (e.g. after toggling a filter). They weren't because the list renderer didn't called 'on_attach_callback' on its subwidgets at reload (thus, 'mounted' wasn't called on its subcomponents, and the decorations are applied in the mounted hook). This commit moves the logic from the FormRenderer to the BasicRenderer, so that it applies on List, Kanban, and Form views. This commit also removes the transition scss rule on the badge field widget as it caused a flickering at reload. Task 2336440 closes odoo/odoo#57762 X-original-commit: 713bce22e8f412f2c26e663b9e30fdd64933ff0c Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-11[FIX] web: fix picture glitchhku-odoo
currently, whenever the view is change the picture zoomed in and still displayed, only disappears after having refreshed the page so, in this commit the employee picture should no longer to be zoomed in whenever change the view closes odoo/odoo#57571 Taskid: 2311308 X-original-commit: 8214332ccd86e52c4f18de8d5428a1a22f2ad21c Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
2020-09-10[IMP] web: add the raw value of selection fieldswan
Task 2327599 It is used in the selector of a tour to know the type of a document.
2020-09-11[FIX] web: blank value in many2many_tags for multi_edit popupMohammed Shekha
Let's assume a list that is multi editable and contains a m2m field displayed with widget many2many_tags. Moreover, there are enough values in the comodel s.t. the 'Search More' option is available in the many2many_tags dropdown, and field 'display_name' isn't in the list view that opens in dialog. Enter multi-edition, edit the many2one field to add a value (click on 'Search More', and pick a value from the list): the picked value isn't correctly displayed in the confirmation dialog. The issue occurred because we didn't wait for the display_name to be fetched before opening the dialog. Task : 2150384 closes odoo/odoo#57481 X-original-commit: ccf5834045d8b4fff9af7ddf60814c3a640e8318 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Dhruv Patel <dhp@odoo.com>
2020-09-10[IMP] auth_totp: notify user on activation and deactivation of OTPXavier Morel
Was not super visible, especially without HR as the dialog immediately closes (limitation of the web client), or when an administrator user massively disables totp. Show a toast notification indicating the success of the action. Also fix the logging of `totp_disable` so it correctly handles being called on more than one record, and change the logging data to <browse_record> (<logins>) across the board. Also add a way to provide an action to execute after a notification: by default nothing happens, which leads to dialogs not closing and forms not reloading, and there is no good way to show a notification and/then do some other thing, which is inconvenient.
2020-09-10[IMP] web, website: prevent auto scroll from left panelLaurent Stukkens (LTU)
* Prior to this commit, when starting to drag a new snippet from the left panel, the auto scroll feature was triggered if the snippet was one of the top or bottom ones. * After this commit, the auto scroll feature will be disabled from the left panel. task-2307404 closes odoo/odoo#56208 Related: odoo/enterprise#12539 Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
2020-09-09[FIX] web: no more double discard dialogDhruv Patel
This issue only occurred in community. Steps to produce: 1) Create/Edit any record. 2) Change the menu using menu switcher 3) You will get the discard dialog at the instance and after some time it will also display another duplicate discard dialog. So, we have one extra redundant discard dialog on menu switching. It is working fine when we have dirty form and then click on the breadcrumb or click on any internal child menu. Task : 2312437 closes odoo/odoo#57343 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-09-09[FIX] web: kanban quick create: fix raise conditionAaron Bohy
Let's assume a kanban view using a custom form view to quick create record: <kanban on_create="quick_create" quick_create_view="view_ref"> Before this commit, there was a raise condition that could lead to a crash. For instance, click to quick create a record in a given column, and while the form view is loading, fold the column. Issue reported on task 2323196 closes odoo/odoo#57318 X-original-commit: 9fed69b9e0e13652fd17e9a7c7c8dd838e2f22ed Signed-off-by: Michaël Mattiello <mcm-odoo@users.noreply.github.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-04[FIX] web: avoid displaying noContentHelper after kanban quick_createLucas Perais (lpe)
Have a kanban with a filter Quick create a record in one column that won't match the domain Before this commit, the noContent helper was displayed. This was because the count of the group was reset to zero after the web_read_group call. After this commit, the noContent helper is not displayed. Note that in the quick_create situation, the records are not re-fetched i.e. there is no search_read after the read_group. Task-id 2251734 closes odoo/odoo#57066 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-04[FIX] web: list: do not call on_attach_callback at reloadAaron Bohy
Before this commit, the ListRenderer's on_attach_callback hook was called each time the view was reloaded, even though the renderer was already in the DOM. As a consequence, sub components were mounted several times, which could lead to issues. For instance, go to Inventory > Operations > Transfers, create a new one. Change the Operation Type to a Receipt, and change again to a Delivery: it crashed. Task 2315149 Closes #56701 closes odoo/odoo#57099 X-original-commit: 78f361fb5382e4c7aed9a4e705e20f8d8757300d Signed-off-by: Julien Mougenot (jum) <jum@odoo.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-03[FIX] web: form: Archive action when field not in viewAaron Bohy
Before this commit, when being in a form view without active field (the field is defined on the model, but not present in the view), the action "Unarchive" was available in the Actions menu, even though the record was actually active. The issue has been introduced by [1]. This commit restores the previous behavior: when the active field isn't in the view, the Archive/Unarchive action isn't available in the Actions menu. [1] 220eb4db391d8ba49dd26bdd3d8af1c27b433d78 closes odoo/odoo#57038 X-original-commit: 97b70aab69b491443d862847fbff69c4e29274af Signed-off-by: Julien Mougenot (jum) <jum@odoo.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-03[IMP] web: new widget for static image urls in char fieldsVictor Feyens
This new widget allows definition of Images through static urls stored in a Char field. It was implemented to provide a way to reduce databases footprint by using static files instead of duplicating them in the databases (& their backups).
2020-09-01[IMP] base: Document layout preview improvementsSimon Genin (ges)
The document layout preview is a complete defferent simplified template with its own css that replicates at best the different styles. It does not have the external layout features and lack of fidelity. The new preview actually use the real documents templates and put the result in an iframe. It now has a high fidelity, though not perfect. The goal is for a better onboarding, where clients see easely how documents will look if they had an app to generate them. Of course, the data on the document is a false invoice. Refactor all this from base to web. Task ID 2304177 closes odoo/odoo#56415 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-09-01[FIX] web: do not display nocontent help if emptyMohammed Shekha
Have an action which help field has the value: ``` <p></p> ``` Display an empty list or kanban Before this commit, the nocontent helper was displayed even though there was nothing to display. After this commit, an empty html tag is the same as an empty string, so the helper is not displayed. task-2320318 closes odoo/odoo#56875 X-original-commit: 3d6bdc5b01a4a94de9baa9bae230e6b34f38dbc9 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-08-27[FIX] web: implement more complete menu autohiding featureqsm-odoo
The code in charge of adding inside a dropdown the menu items that would be forced on a second line was not doing it properly when there were some display: none items and especially not when there were neighbours using the m*-*-auto classes. Part of https://github.com/odoo/odoo/pull/56427 task-2264627
2020-08-25[IMP] web: do not resize quick create form on window resizeMohammed Shekha
The quick create form view is explicitly given the o_xxs_form_view class at initialization but resizing the window sometimes changes that class on form element in enterprise. To avoid this in the quick create case, the method _applyFormSizeClass has been overriden in QuickCreateFormRenderer in order to do nothing when the window is resized, so that the class and the related style stay the same as expected. Task ID: 2317807 closes odoo/odoo#56517 X-original-commit: f9c605ea578267de17e6c1dcc69dfd179d5d95fe Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-08-25[FIX] web: open list optional fields dropdown position to right placeHardik Prajapati
before this commit, when there are too many fields on list view and list view has horizontal scroll opening optional dropdown does not open on right place, instead it opens bit left side from the right. this commit fixes the issue by appending dropdown div inside table element, as scrollbar comes inside table element, so appending dropdown element inside table just after dropdown toggler. task-2307248 closes odoo/odoo#56509 X-original-commit: 5a044593ba1f8f08f72de502d77823a8dd5175a0 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-08-24[FIX] web: crash_manager uses BrowserDetectionLucas Perais (lpe)
Before this commit, the crash manager used a copy of the browser detection isBrowserChrome method because it was not possible to to register the proper dependency in stable version This commit makes the crash manager use the module BrowserDetection for that purpose, with the proper registered dependency before hand closes odoo/odoo#56360 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2020-08-21[FIX] web: crash manager correctly formats error message in FirefoxMohammed Shekha
Have a piece of code that throws an Error In browsers not powered by V8, the stack trace won't be formatted and the Error type won't appear in the crash manager modal report. This happens because Error.prototype.stack is non-standard, although most browsers have an implementation of it. Chrome for example automatically formats the Error. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error https://v8.dev/docs/stack-trace-api\#compatibility After this commit, the Error is formatted in the crash manager report, the same way as Chrome does it. task-2191727 closes odoo/odoo#56318 X-original-commit: dbf670f2e0ec797aeaf998aa28b32afbdd2c3b4c Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Signed-off-by: Christophe Monniez (moc) <moc@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com> Co-authored-by: Hardik Prajapati <hap@odoo.com>
2020-08-20[REF] web: BasicModel: combine default_get and onchangeLucas Perais (lpe)
This commit adapts the BasicModel to combine calls to `default_get` and (first) `onchange`. When creating a new record, we now only call `onchange`, which thus return default values and potential onchange values. Tests (and the MockServer) have been adapted accordingly. NOTE 1. If the `default_get` within the `onchange` returns a value for a field that is not in the view, we ignore it, and it won't be saved. Before, that value was kept and sent upon save. This change in behavior may prove problematic, although the overall risk is small. Decision has been made to keep heavy comments and code snippets if we were to revert back somehow to the previous situation. NOTE 2. Putting a context on a many2one field may change the value returned by `name_get` for that field. By default, the calls to `name_get` are done by `onchange`. If the context on a field must be used for `name_get`, one has to set the option `always_reload` to `True` on the field. In that case, every `onchange` that changes the value will trigger an extra `name_get`. NOTE 3. Suppose that a one2many field has a list view with field A, and a form view without field A. When adding a line, we now send all known fields (main view and inline views) to the `onchange`, which may return a default value for A. The value will appear on the list view, but not in the form view. The former behavior was to call `default_get` with the fields that occur in the form view only, and therefore field A would be left to value `False`. NOTE 4. A test surprisingly adds an extra call to `read`. The test was actually wrong before. With the changes in MockServer, we now correctly receive a command `[6, false, [1]]`, whereas before we received `[1]`, which isn't a valid command, and which was ignored. As a consequence, an extra `read` is done, whereas the test asserts it shouldn't. But it already didn't work before (I checked by sending the correct command). This needs to be bugfixed elsewhere (task-id-2323491): in a o2m with a onchange and default order records on an other page than the first should not trigger a `read`. Task 2261084 Co-authored-by: Raphael Collet <rco@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-08-20[IMP] web: set focus to first visible page when active page invisibleMohammed Shekha
Before this commit: if there are modifiers based on field which hides one page and show another and if active page get invisible then instead of first page second page gets focus, consider following example, `<form> <field name="boolean"/> <page name="page1" attrs='{"invisible": [["bar", "=", false]]}'></page> <page name="page2" attrs='{"invisible": [["bar", "=", true]]}'></page> <page name="page3"></page> </form>` Consider the initial boolean value to be true; initially the first page will be visible. But when "bar" is unchecked then page1 will be hidden and page3 will get the focus as page2 is still not visible: it will be after the computaion/application of all modifiers, which is currently done after the rendering of a tab page. Now: the first visible tab is focused on rendering (same as before) but also after all modifiers have been updated. closes odoo/odoo#56209 X-original-commit: 10365572aa3629e9b19d2b29726b351275de9f52 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Co-authored-by: Ipsita Borisagar <ibo@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com>
2020-08-18[IMP] web: add a size_changed bus eventJeremy Kersten
This commit will add a bus in the web.config config that allows to trigger events. The first use case is the trigger of the size_changed event that is triggered each time the size of the screen changed of bootstrap breakpoint. task-2276740 PR #53175
2020-08-18[IMP] web: Improve kanban quick create keynavJulien Mougenot
The "quick create" form now renders the kanban quick_create buttons on its own. This means that the form handles them as regular form buttons, hence including them in its keyboard navigation. Part of task: 2314864 closes odoo/odoo#55787 Signed-off-by: Mathieu Duckerts-Antoine <Polymorphe57@users.noreply.github.com>
2020-08-18[IMP] web: manage invisible fields in graph and pivot viewJérémy Hennecart
PURPOSE Be able to remove some measures from graph / pivot views. Currently fields are automatically added but some of them make no sense. SPECIFICATIONS Add the possibility to not display some fields in the measures dropdown for the graph and pivot views. When a field is not displayed in the measures of a pivot views we remove them also from the list of groupable fields. LINKS Task ID-2288381 Community PR #54774 Enterprise PR odoo/enterprise#11970 Upgrade PR odoo/upgrade#1519