summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
AgeCommit message (Collapse)Author
2019-09-04[FIX] web: use defined variableChristophe Simonis
Oversight of previous forward-port.
2019-09-04[MERGE] forward port branch 12.0 up to 638eac9baeaChristophe Simonis
2019-09-04[FIX] web: form: race condition when editing in readonlyAaron Bohy
... and switching to 'edit' mode before the write RPC returns. For instance, on a project task form view, in readonly, change the state by clicking on the bullet, and directly switch to 'edit' mode: when the RPC returns, the view is switched back in readonly. Task 2065443 closes odoo/odoo#36400 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-09-03[FIX] web: grouped list as grouped list as childLucas Perais (lpe)
In grouped editable list, get rid of the groups Edit one record in the editable list In a M2O, click on search more In search's list, group by a field Expand a group in the search's list Before this commit, it crashes because the event was propagated onto the first main list After this commit, it doesn't crash and the group is expanded OPW 2064156 closes odoo/odoo#36383 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-09-03[FIX] web: editable list: edit group with create=0Aaron Bohy
This rev. disables the 'create' action in the form view reached when clicking on the 'Edit' button on a group in an grouped list. closes odoo/odoo#36384 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-08-30[MERGE] forward port branch 12.0 up to 52f6e38cea8Christophe Simonis
2019-08-29[MERGE] forward port branch saas-11.3 up to ede253f1b2eChristophe Simonis
2019-08-29[MERGE] forward port branch 11.0 up to d61873ac4a3Christophe Simonis
2019-08-28[FIX] web: dashboard_graph disappearing issue on kanban record reloadJuhil Somaiya
When we try to change the color of kanban, the kanban record is re-renders, kanban record is replaced with kanban-box and subWidgets are re-rendered, reset of all subWidgets are called which will re-render widget but it is not rendered in DOM as DOM element is destroyed and hence dashboard_graph widget can not computed proper height of the canvas element and disappear Call on_attach_callback after widget reset is called on kanban record, as widget element is removed from DOM and new element is added in DOM so on_attach_callback should be called again. task-2036256 closes odoo/odoo#35254 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-09-03[FIX] web: datepicker: crash on invalid dateHarpritsinh Sisodiya
There is an open issue on the tempusdominus lib: https://github.com/tempusdominus/bootstrap-4/issues/223 It occurs when there is a valid value in a date(time) field, and the user unsets it by setting an invalid one. This rev. fixes the issue in Odoo by preventing to reach the buggy piece of code in the lib. In a few words, when the user sets an invalid date, we reset the previous valid date (which is what the lib tries to do anyway). Task 2057009 closes odoo/odoo#36211 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-09-02[FIX] web: add support for `localStorage.key()` and `.length`Alexandre Kühn
These operations on local storage are necessary in order to loop on all local storage keys. Closes #36177
2019-09-02[FIX] bus: background slave tabs should not loose notificationsAlexandre Kühn
Before this commit, some notifications may be lost while forwarding them between browser tabs by means of the local storage (i.e. from the master tab to slave tabs). This happened when some slave tabs are in the background and are throttled by the browser: the master tab writes twice in the local storage (to notify slave tabs of new notifications), and slave tabs drops the 1st notification. This is caused by the mismatch between the new value in the local storage event and the actual value in the local storage. For example: ``` t(0) - Master tab receives `message` notification; t(1) - Master tab writes notifications (= `message`) in local storage; t(2) - Master tab receives `message_seen` notification; t(3) - Master tab writes notifications (= `message_seen`) in local storage; t(4) - Slave tab detects new notifications (= `message`) from local storage event, but drops it since it does not match actual local storage value (= `message_seen`); t(5) - Slave tab detects new notifications (= `message_seen`) from local storage event, and handles it since it matches actual local storage value (= `message_seen`); => Notifications received + handled: - master tab: `message`, `message_seen` - slave tab: `message_seen` => Slave tab lost "message" notification. ``` This commit fixes the issue by letting all tabs handle any local storage events, regardless of the actual value in the local storage. In the example above, this means the slave tab will not drop the notification `message` at t(4). Task-ID 2044231 Closes #36177
2019-08-27[FIX] web: 'create' in context and non inline subviewsAaron Bohy
Let's assume an action with 'create': 0 in the context, and a non inline subview in the form view. Before this rev., the 'create': 0 was applied to both the form view and the subview. This rev. applies the same logic as what the server does for inline subviews: the rule is applied to the subview iff its model is the same as the one of the form view (with key 'base_model_name' set in the context). Task 2035653 closes odoo/odoo#36109 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-08-23[FIX] web: selection: required, option present but disabledLucas Perais (lpe)
Before this commit, a field selection which was required did not have an empty option ref: 4dfabb8f7adde06a7936502af61534c9958ed4f7 This is fine, but overlooked the fact that modules can modify the required attribute, or even views can do it So, we may end up in a situation where the field is required but set to false This configuration is problematic, at least for the timezone selection field (see OPW) After this commit, the empty option is just not visible note that `disabled = True` would not work because val is not accessible Because of commits: - 4dfabb8f7adde06a7936502af61534c9958ed4f7 for the selection feature - d77ce4c2a92c1da48150e4e84b714dd93f64847d overriding the required attribute of tz in res.user form OPW 2057913 closes odoo/odoo#35989 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-08-23[FIX] web: grouped list with <groupby> node and onchangeAaron Bohy
Let's assume an editable grouped list view with a <groupby> node containing subfields, and an onchange. Edit a row to trigger the onchange. Before this rev., it crashed because the onchange specs was incorrect: it followed the relation of the many2one and thus included its subfields (whereas it should only follow the relation for x2many fields). For example, go to Accounting > Accounting > Sales and edit the label of a move line. Task 2044187 closes odoo/odoo#36001 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-08-22[FIX] web: graph: id not in groupbyLucas Perais (lpe)
Before this commit, when having the field "id" in the graph view it was selected to group by on it. This doesn't really make sense, and triggers an sql error anyway After this commit, we filter out that field from the groupbys OPW 2053444 closes odoo/odoo#35958 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-08-27[FIX] web: searchbar: focus first itemJulien Mougenot
Doesn't focus hovered option in the searchbar Before this commit: When typing in the searchbar while having the cursor right under it, the selected option was automatically the one hovered by the cursor. Now, the default option is the first one (typically name search) and the cursor hovering only takes effect when moved for the first time. Task 2058656 closes odoo/odoo#36099 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-08-28[IMP] web: remove m2o from supportedTypes in selection widgetMohammed Shekha
currently widget selection is not working in m2o in editable list view and to fix this issue it need a lots of changes to make it work properly, i.e. make '_fetchSpecialRelation' use correct domain for each record, batch requests as much as possible, also make all '_fetchSpecial...' work in the list case. So to avoid major changes remove supportedTypes from selection widget so user can not tempted to apply selection widget on many2one field. task-1871698 closes odoo/odoo#33485 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-08-21[MERGE] forward port branch 11.0 up to 1b234b1be75Christophe Simonis
2019-08-19[MERGE] forward port branch 12.0 up to 32039b2ab44Christophe Simonis
2019-08-16[FIX] web: list: tweak columns weightAaron Bohy
2019-08-12[FIX] partner_autocomplete, web: autocomplete error when suggested company ↵Jorge Pinna Puissant
has a country - Change the company's country to Finland; - Go to Contacts and click on Create; - Tick the Company box above the Name field; - Start typing into the Name field; - Click on a company with a VAT number under its name. Before this commit, a Traceback appears. This occurs because the response of the request with the suggested company has the fields 'company_name' and 'company_code' and these fields are not in res_partner. Now, the suggested company is parsed to correctly field the country field. opw-2049636 closes odoo/odoo#35631 Signed-off-by: Simon Goffin (sig) <sig@openerp.com>
2019-08-09[FIX] web: add support for TRUE_LEAF and FALSE_LEAF in ModelFieldSelectorJinal Patel
before this commit, domain selector widget does not support TRUE_LEAF and FALSE_LEAF i.e. [(1, '=', 1)] and [(0, '=', 1)] respectively, the reason is the chain part of the domain i.e. field name has value 1/0 and we don't have field name like 1 and 0 in domain and hence ModelFieldSelector don't accept it after this commit, domain selector can handle this special two domains which is [(1, '=', 1)] and [(0, '=', 1)], add support for chain with 1/0 in ModelFieldSelector task- 1998145 closes odoo/odoo#35603 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2019-08-07[FIX] web: favorites have unique descriptionsMathieu Duckerts-Antoine
In the favorites menu, it was possible to create two favorites with the same name (contrarily to the specifications). The root cause of the problem was that the submenus of the favorites menu were not updated at all. This commit fixes that situation. closes odoo/odoo#35495 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2019-08-07[FIX] web: toggle favorite correctly updates other filters statusMathieu Duckerts-Antoine
When toggling a favorite filter, the options used by the active date filters/groupbys and the field created via autocompletion were not correctly cleared, leading to strange situations. This is fixed by this commit.
2019-08-08[FIX] tools: epsilon magnitudeNicolas Martinelli
The following rounding is incorrect: ``` >>> float_round(6.6 * 0.175, precision_digits=2) 1.15 ``` Indeed, 6.6 * 0.175 = 1.155 ≈ 1.16. In this specific case, the `epsilon` computed is not sufficient. A precision of 53 gives: normalized_value = 115.49999999999997 epsilon = 1.2823075934420547e-14 => new normalized_value = 115.49999999999999 Bad luck, this is just not enough to tip the value in the right direction. However, a precision of 52 is sufficient: normalized_value = 115.49999999999997 epsilon = 2.5646151868841094e-14 => new normalized_value = 115.5 The value of 53 was chosen from the `binary64` number format precision. In case of Python, the corresponding machine epsilon is 2^-52 [1]. Therefore, using 52 instead of 53 does make sense. It is worth noting that the value of the machine epsilon 2^-52 = 2.2204460492503131e-16, which is still 2 orders of magnitude below our dynamic estimation. [1] https://en.wikipedia.org/wiki/Machine_epsilon [2] `numpy.finfo(float).eps = 2.2204460492503131e-16` opw-2047368 closes odoo/odoo#35565 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-08-07Revert "[FIX] web: hide dashboard tooltip on page change"Christophe Simonis
Mow that the Journal Dashboard use Chart.js, this patch is unneeded. This reverts commit 6d9dabd5d933c5cd6ba5a42103894d731a5689a0. Oversight of previous forward-port.
2019-08-06[MERGE] forward port branch saas-12.2 up to 9e74730a26bChristophe Simonis
2019-08-06[MERGE] forward port branch 12.0 up to ff9ddfdacc9Christophe Simonis
2019-08-06[MERGE] forward port branch saas-11.3 up to 97d81f1220bChristophe Simonis
2019-08-05[FIX] web: RTL on list viewNicolas Martinelli
- Set the user language to a RTL language, e.g. Arabic - Open a list view containing float or monetary fields, e.g. the invoice list view The numbers are left aligned while the corresponding columns headers are right aligned, making the list view confusing. The header alignment is hardcoded at rendering rather than in the SCSS. Therefore, `rtlcss` doesn't affect it. Instead of hardcoding the alignment, we use a proper CSS class so it is adapted by `rtlcss`. opw-2044019 closes odoo/odoo#35414 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-08-02[FIX] web: spam new event creates multiple modalsJulien Castiaux
On the Time Off, spam click to create a new event, each click opens a new event form modal. When the modal form fields have not been cached yet, the frontend fetches them and delay the modal form opening after those fields have been fetched. As the interface is still available. It is possible to re-click multiple time during the fetch, each click schedules a new modal form. When the first finally shows, they all stack on screen. opw-203577 closes odoo/odoo#35098 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-08-02[MERGE] forward port branch 11.0 up to 593f631e5ebChristophe Simonis
2019-07-31[FIX] web: init makeRecord fields with correct valuesLucas Perais (lpe)
In the calendar view In the partner filter in the calendar side bar type something, and backspace rapidly to remove everything Before this commit, there was a error because the framework tried to write something in the corresponding field This was because the o2m field was not initialized with the correct values After this commit, there is no error OPW 2043975 closes odoo/odoo#35330 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-08-07[FIX] tools: epsilon magnitudeNicolas Martinelli
The following rounding is incorrect: ``` >>> float_round(6.6 * 0.175, precision_digits=2) 1.15 ``` Indeed, 6.6 * 0.175 = 1.155 ≈ 1.16. In this specific case, the `epsilon` computed is not sufficient. A precision of 53 gives: normalized_value = 115.49999999999997 epsilon = 1.2823075934420547e-14 => new normalized_value = 115.49999999999999 Bad luck, this is just not enough to tip the value in the right direction. However, a precision of 52 is sufficient: normalized_value = 115.49999999999997 epsilon = 2.5646151868841094e-14 => new normalized_value = 115.5 The value of 53 was chosen from the `binary64` number format precision. In case of Python, the corresponding machine epsilon is 2^-52 [1]. Therefore, using 52 instead of 53 does make sense. It is worth noting that the value of the machine epsilon 2^-52 = 2.2204460492503131e-16, which is still 2 orders of magnitude below our dynamic estimation. [1] https://en.wikipedia.org/wiki/Machine_epsilon [2] `numpy.finfo(float).eps = 2.2204460492503131e-16` opw-2047368 closes odoo/odoo#35521 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2019-07-31[FIX] web: date filter options unselected after facet deletionMathieu Duckerts-Antoine
Select the option 'This Month' of a date filter in the filter menu and then remove the facet created correctly toggles the filter from the query but the option is still shown as selected. This commit fixes that situation. closes odoo/odoo#35340 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-25[FIX] web: hide dashboard tooltip on page changeJulien Castiaux
Go to CRM/Sales/Team Pileline. Place your cursor on the chart, a tooltip appears, move your cusror away, the tooltip disappear. Now clic anywhere on the interface so the page change (i.e. on "x Open Opportunities") and quickly while the page loads place your cursor on the tooltip, it appears but when the page change it doesn't disappear. The problem here is that the graph element is removed from the DOM which prevent the correct handling of the `mousehover` event used internally by nv.d3 to show/hide the related tooltip. The solution is to manually hide the tooltip when the graph element is removed from the DOM. opw-2042286 closes odoo/odoo#35172 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-07-23[FIX] web: pivot keeps controlpanel's domain on reloadLucas Perais (lpe)
Open a pivot view, make a search for some field Click on a pivot cell to display the list view of elements matching the group's domain Go back to the pivot using breadcrumbs Before this commit, the original search domain was not kept across those actions After this commit, it is kept This difference is due to the fact that before 12.2, the whole action had an env, containing the search domain in 12.2 and afterwards, things are not done this way anymore OPW 2030555 OPW 2030983 closes odoo/odoo#35096 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-07-19[FIX] web: remove lazyloaded controller from stackAaron Bohy
... if the current action can't be executed. Let's assume a form view for a record with a multicompany ir.rule. If the user switches to another company, the webclient is reloaded, but he doesn't have access to that record anymore. In this case, he is redirected to the Home menu. Before this rev., when he clicked on an app in this situation, it crashed. This was due to a leftover reference of the failed action (the lazyloaded, multi-record controller) in the controller stack. closes odoo/odoo#34994 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-23[MERGE] Forward port of 12.0 to saas-12.2 up to 5e4c1b370123deeMartin Trigaux
2019-07-22[IMP] web: do not set focus on form when lastActivatedFieldIndex is not setMohammed Shekha
When opening a dialog using mouse and closing it, form_dialog_discarded is triggered, which tries to set focus on form while lastActivatedFieldIndex is -1, as dialog is opened using mouse directly do not set focus back to form widget if lastActivatedFieldIndex is -1 task-2031706 closes odoo/odoo#34684 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-16[FIX] web: no forced date matching in pie chartsMathieu Duckerts-Antoine
In a graph view in mode 'pie', a matching of dates was attempted each time a comparison and a grouping of data using the same date/datetime field was done. Unfortunately, since the read groups results are ordered using the order of groupbys, the matching was not sensible in case the date/datetime field was not the first groupby. We thus restrict the matching to the sole case where it is sensible. More work should be done to have sensible matchings in all situations. closes odoo/odoo#34379 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-16[FIX] web: style chart elements in graph views only locallyMathieu Duckerts-Antoine
The elements style was set globally and thus used to modify the style of any chart in Odoo after the first loading of a graph view. For instance, the charts drawn in sale_subscription_dashboard are not the same before and after the first loading of a graph view. This is fixed by this commit.
2019-07-16[FIX] web: appropriate symbol in mobile embedded graph view groupby menuMathieu Duckerts-Antoine
2019-07-16[FIX] web: fix Groupby menu style in embedded graph viewsThomas Werland
2019-07-29[FIX] web: fix error when image field can't load imageVincent Schippefilt
when image field cannot load an image, it will default to the placeholder image. If this placeholder image also cannot be loaded it was creating an infinite loop errors After this commit, we only show one error if the original image cannot be downloaded and if the placeholder cannot be downloaded, we don't show anything else. closes odoo/odoo#35226 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-26[MERGE] forward port branch saas-12.2 up to 1d6d790513eChristophe Simonis
2019-07-25[FIX] web: properly handle (grouped list) pagerGéry Debongnie
when last field is numeric closes odoo/odoo#35176 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-24[FIX] web: improve editable list column widthsJulien Mougenot
Changed the way some field types are displayed. Before this commit, column width in a list were calculated according to a given factor (integer), determining their weight. Now, some specific fields have an hardcoded width instead. This task also slightly tweaks some width factors, in order to try to have a better layout in most list views Task 1985916 closes odoo/odoo#35147 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-07-24[FIX] web: context when read on multi editsvs-odoo
Before this commit, in list editable, when user save multiple records in the same time, the context is passed for the write but not for the read. Now, the context is passed also for the read. closes odoo/odoo#35113 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>