summaryrefslogtreecommitdiff
path: root/addons/web/static
AgeCommit message (Collapse)Author
2021-05-31[FIX] account, mail: link attachments to invoiceAdrien Widart
When using the "Send & Print" functionality, if the user adds an attachment, the latter won't be linked to the record. To reproduce the error: 1. Open a posted invoice 2. Send & Print 3. Attach a file > Select a file on your device 4. Send the email Error: The invoice's PDF is added to record's attachments, but not the other file (from step 3). When the module selects the attachments that need to be linked to the invoice, it only keeps the ones currently linked to `mail.compose.message`: https://github.com/odoo/odoo/blob/6441ab71cb68648aa735057952bf757677a20ee3/addons/mail/models/mail_thread.py#L1719-L1725 This is correct when the user creates a message directly in the chatter. However, when the mail is created thanks to `Send & Print` functionality, the attachment is linked to `account.invoice.send`. Another flow have a similar issue: from invoices list, select few ones, Action > Send & Print: the generated PDF won't be attached to their invoice. In such a situation, here is the source of the problem: https://github.com/odoo/odoo/blob/05ad6c477f7da2a495e5baf5b4629323b9d11fa0/addons/mail/wizard/mail_compose_message.py#L363-L367 There isn't any information about the invoice, therefore it is not possible to linked the attachment to it. OPW-2438457 closes odoo/odoo#71425 X-original-commit: e87f599d4eb22250b628d650b9f59b54db8d043c Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-28[IMP] web: add findWhere utilsBruno Boi
closes odoo/odoo#70936 Taskid: 2412172 Related: odoo/enterprise#18366 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-05-28[FIX] web: parseDateTime util optimizationsBruno Boi
- `parseDateTime` util: we now caches "without zero" date and time formats Taskid: 2412172
2021-05-28[FIX] web: allow custom filters by ID intervalIvan Yelizariev
Infinite number of records cannot be exported, so after some limit we will get a timeout error. If you need to export more records than that limit, you should be able to filter records into batches. The easiest way to do it is making a filter by ID: ``` [Y| ID Greater than 100000] [Y| ID less than or equal to 200000] ``` --- opw-2517946 closes odoo/odoo#71345 X-original-commit: 2e0127af0d283d1d9bdb033de356e2ddf0973cce Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Ivan Yelizariev // IEL <yelizariev@users.noreply.github.com>
2021-05-28[FIX] web: add the context in the parameters of the rpc in the _renderBannerDjamel (otd)
Steps to reproduce the bug: - Install Accounting - Connect with a user who has a default company (e.g: Company A) and allowed companies (e.g: “Company A” and “Company B”) - Choose in the company selector “Company B” - Make sure that the onboarding panel in the default company has not been closed - Go to accounting and close the onboarding panel - Refresh the page Problem: The onboarding panel is still open because in the `account/account_dashboard_onboarding` method we check the`account_dashboard_onboarding_state` field of the default company instead of the current company because "allowed_company_ids" is not in the context This problem is also present in all the other views where an onboarding panel is present Solution: Add the context in the parameters of the rpc in the _renderBanner opw-2477148 closes odoo/odoo#71384 X-original-commit: 902950541f8c361e03821314aab4bf4f304ac37d Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com> Signed-off-by: Djamel Touati <DjamelTouati@users.noreply.github.com>
2021-05-21[FIX] web: fix crash on editable list view when moving over a RO fieldAnh Thao Pham (pta)
This is a forward-port of commit https://github.com/odoo/odoo/commit/970387f91fea0cb47404612f7d519ffba2c9ad3b In editable list view, moving to next cell using TAB key crash when the following field is becoming read-only (i.e non-focusable) and an onchange() event is triggered. Consider an editable tree view like this: <form> <field name="o2m" onchange="1"> <tree> <field name="description"/> <field name="date" attrs="{'readonly': [('description', '!=', False)]}"/> <field name="type"/> </tree> </field> </form> 1. Edit 'description' 2. Issue a TAB keypress before 'date' becomes read-only It will crash while calling getSelectionRange() on an empty element. opw-2523630 closes odoo/odoo#71122 X-original-commit: bd6ba50e073ffff0bd51b1a02d51260f09e36357 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2021-05-19[FIX] web: update owl from 1.2.5 to v1.2.6Géry Debongnie
This commit updates owl to the latest release. It only contains a small fix to the router (route params handling) Release on github: https://github.com/odoo/owl/releases/tag/v1.2.6 closes odoo/odoo#71023 Signed-off-by: Samuel Degueldre <sdegueldre@users.noreply.github.com>
2021-03-24[FIX] web: disale autofill on input elementsMohammed Shekha
with this commit we disables autofill of autocomplete by setting autocomplete=off, this was previously done in commit: 64293fbdb0a247f689c1b0b0c580d9ce577af510 but it was not working because we were setting autocomplete=none it seems that none does not work all the time. task-2462676 closes odoo/odoo#68271 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-05-18[FIX] web: update owl from 1.2.4 to v1.2.5Géry Debongnie
This commit update owl to the latest release. It only contains a small fix on the order of lookup for the t-component directive. Release on github: https://github.com/odoo/owl/releases/tag/v1.2.5 closes odoo/odoo#70935 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-05-17[FIX] web: domain: (=)(i)like operatorsAaron Bohy
Before this commit, evaluating a domain containing a like/ilike operator with an evaluation context in which the value was false crashed. Moreover, those operators were wrong w.r.t. the case sensitivity: like was case insensitive, whereas ilike was case sensitive, and both =like and =ilike were case insensitive. This commit fixes thoses issues. The first issue was spotted on our prod, as we tried to add an invisible attrs in a form view, using the ilike operator (it thus crashed in create mode). The second issue was spotted while writting the test cases. To the best of our knowledge, those operators aren't used in attrs (for now), explaining why those issues haven't been found before. closes odoo/odoo#70876 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-05-17[FIX] *: update documentation links Following the recent reorganisation of ↵Victor Feyens
the documentation in 12.0+, the majority of the documents have been moved and their old links are no longer valid. Some redirection rules will soon be deployed, but those rules might be dropped in some years and we want the links to still work, which is why we still replace the links to the new ones. FW-Port of odoo/odoo#70675 (13.0) closes odoo/odoo#70728 X-original-commit: 85c24961ab9ff5c1c79eb7415c97c46d9a77cca3 Related: odoo/enterprise#18283 Signed-off-by: Victor Feyens (vfe) <vfe@odoo.com>
2021-05-12[FIX] web: remove bottom border of first table rawAdrien Widart
When using the boxed layout, if the business document has a table, its first row (after the table head) will have a bottom border and the last cell in the row has a white background. To reproduce the error: (Need timesheet_grid. Use demo data) 1. In Settings > General Settings, Change Document Template: - Select the second template 2. In Timesheets, select list view 3. Select several lines 4. Print > Timesheet Entries Error: In PDF, the first timesheet line has a bottom line and its last cell has a white background (instead of grey). The bottom line should only be applied on row in table header. The background color should also be applied on first row in table body. OPW-2478311 closes odoo/odoo#70746 X-original-commit: 88a10bdd8f1d46a8b52be59fe3284cbe284a74f2 Signed-off-by: Adrien Widart <adwid@users.noreply.github.com>
2021-05-11[FIX] web: Allow user to add product Description with studioAchraf (abz)
What are the steps to reproduce your issue ? 1. From the product form, go to the website version, edit it to add tabs 2. Using studio, add the field "Description for website" to a tab of the notebook 3. Save, click Edit, go to the tab that has the field What is currently happening ? Traceback: form_renderer.js:258 Uncaught (in promise) TypeError: Cannot read property 'querySelector' of undefined at Class.setLocalState (form_renderer.js:258) at Class.setLocalState (form_editor.js:131) at Class.prototype.<computed> [as setLocalState] (class.js:90) at view_editor_manager.js:184 What are you expecting to happen ? Correctly add product description without tracebacks Why is this happening ? Because the number of tab is not equal to the number of pages How to fix the bug ? Before accessing the element, check if it exists opw-2378743 closes odoo/odoo#70513 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-05[FIX] web: Aria attributes on buttons Export All & optional columnsLuis González
Some aria attributes were missing or incorrectly set on these new buttons: - The button "Export All" was missing an `aria-label` attribute - The button to show/hide optional columns was also missing an `aria-label` attribute, and its menu items (checkboxes to show/hide columns) were missing a proper role - Ever since the debug manager was added in frontend on 73327db0656b, the `aria-label` attribute was not being rendered correctly on the button to open developer tools closes odoo/odoo#70390 X-original-commit: 620e4cc28cefed6f4a3b5ca89b11cc37222acfaf Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-05-03[FIX] web: no error on single active_ids state loadPhilémon van Helden
In eg. 13.0 when refreshing sales analysis action of a product, we would get an error because we have a single active_ids which is not expected by the code. With this commit, we use .toString() on the jQuery BBQ parsed active_ids as it was done before 32b8cec5 refactoring (january 2018). The added test with the fix fails with an error: TypeError: state.active_ids.split is not a function at Class.loadState (/web/static/src/js/chrome/action_manager_act_window.js) opw-2471982 closes odoo/odoo#70279 X-original-commit: bf9a985f4b62cc6f1eef4f9fcca2a8dfbd453004 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: pvh-odoo <SwagSamaSempai@users.noreply.github.com> Co-authored-by: Nicolas Lempereur <nle@odoo.com>
2021-04-29[FIX] web: pdfjs: hide buttons that doesn't work in webviewsRomeo Fragomeli
Some features of the PDF.js library doesn't work in the webview of the mobile apps. Initially 'window.print' is defined as an empty function in webviews unlike browsers where it is already ready. After that, PDF.js needs to monkey patch 'window.print' and saves a reference to the original definition, which is not yet fulfilled in by the mobile app (Java part). So the print of PDF.js doesn't work in webviews and end users will need to download the file before printing it. Regarding the Download button, the 'download' attribute is not supported by the webview as you can see in: https://bugs.chromium.org/p/chromium/issues/detail?id=432414 As there's many ways to download a file in Odoo it's not a big deal to simply hide it in PDF.js. Because it's quite complicated to fix this, we decided to hide the features that don't work (Download / Print) or don't make sense (Open file). Note that a refactoring is already in progress in order to avoid to patch this library in master. closes odoo/odoo#70092 Task-id: 2200168 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2021-04-29[FIX] *: bunch of mismarked translation specifiersXavier Morel
`_(xyz)` will wrap them in an underscore.js object, which when used in a string context will just return the string. So it's basically a no-op, but it certainly doesn't translate the terms. closes odoo/odoo#70000 Related: odoo/enterprise#18001 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-04-28[FIX] web: make test pass on chrome 90Aaron Bohy
The changed test uses the drag&drop helper, and an operation does not work as expected with the given params on chrome 90. The runbot currently uses chrome 80, so it is not an issue, but if your chrome is up-to-date, and you try to run the test suite, this test would fail. closes odoo/odoo#70008 X-original-commit: 43994da9980e4133274984f720bb58f3546ea0f9 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-04-28[FIX] web: web client boot when user has not apps availableXavier Morel
This mostly an issue when trying to run just the tests of `web` (aka `-iweb`) with only community modules available, `TestMenusDemoLight.test_01_click_apps_menus_as_demo`, wait for the ready code times out: AssertionError: False is not true : The ready "odoo.isReady === true" code was always falsy and the test suite fails. The ready code simply checks that `odoo.isReady` is set. The web client sets `isReady` when `webclient_started` is triggered (specifically in `_onWebClientStarted`, which is the handler for that event). [The community web client only triggers `webclient_started` at the end of `doAction`][0] meaning the community client is considered ready until after the first action has executed. [The first action is executed by `show_application`][1] whose process is the following: 1. load and initialize the menus 2. if an action is specified in the URL, run that 3. otherwise if the user has a home action, run that 4. otherwise run the first menu's action When installing only `web`, the only menus which could be available are Apps and Settings, and the demo user has access to neither. This means the demo user has no applications, and opening the first app is a no-op ([`openFirstApp` has a case just for that situation to ensure it does nothing][2]). As a result, `webclient_started` is never triggered, `_onWebClientStarted` is never called, `odoo.isReady` is never set, and the tour never runs. Fix by updating `openFirstApp` to return *whether* it opened an application, and in `show_application` the last fallback if even opening the first application failed is to just declare the web client ready. While at it, rewrite `show_application` using ES6 facilities and flatten and linearize it using guards. This means the code pretty much tracks the process described above, with one step added: 5. otherwise complete the webclient's startup [0]: https://github.com/odoo/odoo/blob/1eb474243b55f1b9e10c70d199bbe022e68b51d0/addons/web/static/src/js/chrome/action_manager.js#L174 [1]: https://github.com/odoo/odoo/blob/d1c56ec7c435c5baba8604feccc6116e4c25ca96/addons/web/static/src/js/chrome/web_client.js#L77-L107 [2]: https://github.com/odoo/odoo/blob/e24ab17d38fb049404f04112990e8b2fe1dd7727/addons/web/static/src/js/chrome/apps_menu.js#L44-L46 closes odoo/odoo#69962 Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
2021-04-21[FIX] web: find scrollingElement despite roundingNicolas Lempereur
In mass mailing edition, in some configuration of: - being in a modal or not - size of window - zoom level we might get an error when getting the scrolling element. For example when editing a mass mailing, if I set my viewport to 595 pixels height and have a 90% zoom, the editor is broken. This is because in SnippetsMenu.starts `$().getScrollingElement()` doesn't find an element that has the height of body. In my use case body height is 329.111 pixels, and scroll height is 328 pixels. Testing different zoom level and viewport height, the maximum difference I was able to get was 1.25 so this commit increase to 1.5 the maxmimum difference. opw-2455727 opw-2469174 closes odoo/odoo#69592 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-04-19[FIX] web: properly unpatch session after each testAaron Bohy
Before this commit, `getTZOffset` and `user_has_group` weren't correctly reset to their initial values after tests. As a consequence tests executed afterwards might behave unexpectedly. closes odoo/odoo#69485 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-04-15[FIX] web: do not use default en_US lang when loading translations from sessionAnh Thao Pham (pta)
When loading translations from Session, if no lang is defined in context or html, it is loading translations of en_US lang by default. No default should be used to fallback on the language of the current user. opw-2501708 closes odoo/odoo#69318 X-original-commit: a93a0a33c7447505403097c7ba0707d55d252e64 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: Anh Thao PHAM <kitan191@users.noreply.github.com>
2021-04-13[FIX] web: onchange: send correct nested x2manys valuesAaron Bohy
Commit [1] recently fixed an issue with nested x2many fields and onchanges: in some cases, all field values weren't sent to the server as they should. However, there is a small issue with this fix. We didn't correctly apply the default value to option `changesOnly`: when not given, it was considered false, whereas in this particular function it should have been true. It caused an issue in the following scenario: Have a form view with an x2many field (say A) displayed as a list. In the list, there is another x2many field (say B), and (whatever its type) a field C with an onchange. When the user changes C, the onchange is performed, and we send to the server the value of all fields. In particular, in the row, we send the value for the many2one field pointing to the main record (the inverse field of the x2many relation). The value for that field is basically the whole record, containing itself field A. For field A, the value is a list of commands, and for the updated record, it is a command 1. Before this commit, in the values sent for this command, field B was the empty array, even if it wasn't empty. This issue was reproducible in account.move, on an existing record having already a line in invoice_line_ids (this is field A). In that line, tax_ids (this is field B) must have a tax which is included in the price. When changing the quantity of the product, the subtotal wasn't correctly computed. [1] https://github.com/odoo/odoo/commit/a8b43d02066b2299ac2f4b88056c37725e9ce6cd opw~2489755 closes odoo/odoo#69167 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-04-02[FIX] web: ignore recursiveCallMounted on not yet rendered childrenSébastien Theys
This should hopefully fix the race condition that is described in the related task. The issue is that our mounted callbacks are legitimately relying on the component to be actually rendered. task-2481713 closes odoo/odoo#68711 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-24[FIX] web: can update one2many with custom field widgetKrzysztof Magusiak
One might design a custom field widget to display/interact with a one2many field. Before this commit, if this field widget triggered a field_changed event to update a related record, it crashed, because the code assumed that there was a view associated with the field. Closes #68276 opw~2468238 closes odoo/odoo#68294 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2021-03-09[FIX] web: fix float value representation in exportAndrea Grazioso (agr-odoo)
- Create a product with: Cost: 60.80 Quantity On Hand: 999.0 - Go to Inventory / Reporting / Inventory Valuation - Click on export all (little button next to "Inventory at date") The field "Total value" have too many decimals: 60739.2000000004 This occur because of the multiplication: it yield the correct value (60739.2), but every rounding attempt done, even in the ORM, will mess up the representation https://github.com/odoo/odoo/blob/042298f8c949fba470eda6ad90f94c95ca291030/odoo/fields.py#L1333 opw-2438384 closes odoo/odoo#67543 X-original-commit: 67cf82962688360cfe25c6b2118a7dbd17a6ee95 Signed-off-by: agr-odoo <agr-odoo@users.noreply.github.com>
2021-03-11[FIX] web: hide filters not relevant to the current screenAndrea Grazioso (agr-odoo)
Open Calendar weekly view Scroll the weeks The 'Responsible' filter will accumulate entries from the events and not deleting them. This create issue with the view in db with heavy calendar use and a lot of responsibles This reverts commit 64d0fe411840fb43c96f0252a7ff5e74bd7cdc90, coming from task 2146842, addressing the following issue in calendar view (i.e. in planning app) not reproducible anymore " In calendar view, when you unselect all filters of a category, all events disappear (it's expected), but all filters also disappear. So you can't selectd anything, you must reload the view to unlock the situation. " opw-2479920 closes odoo/odoo#67710 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-03-18[FIX] web, web_editor, website: fix incorrectly translated template literalsSamuel Degueldre
closes odoo/odoo#68085 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
2021-03-17[FIX] web: compute default locale of Date(Time)Picker at the right timeNasreddin (bon)
Issue - Install "Accounting" - Change user language to arabic - Go to Customer Invoices list view - Try to filter on field "Created On" Traceback is raised from the DatePicker Component Cause The cause is two fold: There is an issue in moment that behaves abnormally when its internals are not able to extract the month in a locale, and, instead of returning an invalid moment, it returns a valid moment with the month set to January which just happens to be the first month of moment's default locale ref: https://github.com/moment/moment/issues/5600 Secondly, the defaultProps "locale" of the DatePicker was set to moment.locale() at the file's initial loading, that is, before any user locale parameters were loaded The bootstrap datepicker was then set with the wrong locale, and the case fell under moment's issue After this commit, the locale of the DatePicker is always the one of the user, and there is no traceback opw-2460156 closes odoo/odoo#67320 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Lucas Perais <lpe@odoo.com>
2021-03-16[FIX] web: properly find the scrolling element of zoomed pagesqsm-odoo
To find the main element which scrolls in the page, we rely on its height being as tall as the body one. The code which checks that was making a comparison between a rounded value and floating value without care of the rounding errors that might induce, especially on zoomed pages. Fixes https://github.com/odoo/odoo/issues/63306 closes odoo/odoo#67961 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-15[FIX] web: allow filtering with decimals on price filter + unit testJulien Mougenot
Issue - Install "Sales" - Switch to "German" language - Go to Sales -> Products -> Products - Try to filter on "Public Price" is equal to "2,3" Not possible to add decimal point at the end (only in middle of number). Cause In case the 'decimal point' in DB params is not a dot '.', the filter input will be considered as 'text' instead of 'number'. In case of the 'number' type; HTML do already a pre and post processing, including managing decimal point (who, for example, is not included in ev.target.value if last char is a '.'). Unfortunalty, the library is not well working with other language and not supported on every browser, therefore, must use own logic. In case of a 'text' type, the value will be send to 'parseFloat' ,then `parseNumber` will replace decimal_point by dot (also one the issues since needed to display decimal_point according user language), and `Number` will remove the decimal_point in case of '123,' -> '123', and therefore we will not be able to write decimals ( apart of adding the decimal point after writing the whole number...) Solution If user input is well parsed, store parsed value in condition.value and set condition.displayedValue to the input value (an so without updating input value). Else, replace input value with previous value (who should be the condition.DisplayedValue). opw-2463441 closes odoo/odoo#67767 Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2021-03-15[FIX] web: do not forget to unpatch in testsAaron Bohy
Without this commit, all tests executed after that one would use the patched version of the FormViewDialog. Issue spotted in the assets revamp branch, by moving form_tests.js after calendar_tests.js closes odoo/odoo#67865 X-original-commit: ff19ee8d8b39a719a09dd9f6060faa3afa474da3 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-03-15[FIX] website_forum, *: refit the forum biography popoverOussama MESSAOUDI
*: web task-2276974 closes odoo/odoo#66049 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-12[FIX] web: optional column dropdown out off screen on mobileAdrien Dieudonne
The left css property computation wasn't usefull for ltr mode and even worse, it introduced a bug when a horizontal bar was present (as often on mobile). The entire width of the table was used to compute the offset even though we only saw part of it (scroll bar). It's why this left css property was too high. We can simply remove this logic as "right: 0" on .o_optional_columns already do the job for the ltr mode. Note that we still need to compute the left property for the rtl mode to put the dropdown menu above the table. Otherwise it will be on his left! Steps to reproduce: - Go to Subscription - Open an existing record - Try to open subscription lines column dropdown => You need to scroll on the right to see it. Related PR: https://github.com/odoo/odoo/pull/62472 Related Task ID: 1929043 closes odoo/odoo#67738 X-original-commit: 87c6f6338d267acaab90705f9d5ca8ad27ae30fd Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-03-11[FIX] web: prevent popover race condition between unmount and eventSébastien Theys
These are throttled/debounced so the handlers are sometimes called after the component has been destroyed. opw-2451752 closes odoo/odoo#67723 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-11[FIX] web: nested one2manys, onchange and no commandAaron Bohy
Let's assume the following situation. We have a form view with a one2many field A displayed as a list. In the list, there is a one2many field B. B can't be edited, its value is computed by an onchange. By default, it contains a single record (i.e. the first value returned by the onchange is [[5], [0, 0, {...}]]). When another field (say C) changes, B's value is re-computed to [[5]]. Moreover, there is an onchange on A. In this form view, let's assume the following scenario. Create a new record and add a line to A. In this new line, B already contains a record. Change C. This triggers an onchange that returns [[5]], and B is now empty. It triggers a second onchange, on the main record (as field A changed). Before this commit, in this second onchange, B's value wasn't sent among the other values of the new line. The spec says that for onchanges, we must send all data, not only what has really changed. From that perspective, the above scenario highlights an issue. That issue had two root causes. First, commit [1] wrongly fixed another issue, and as a consequence, when building what to send for the onchange, we didn't generate the values for fields that hadn't changed inside an x2many (for added subrecords at least). This commit reverts the fix of [1], and fixes it differently by only sending a command 1 (update) after a command 4 (link to) when the record is dirty (i.e. when it has been modified). See [1] for context and details. Second, the code that generates the values to send to onchanges is the same as the one that generates the values to save records (write or create). However, when saving, we only send what has really changed. The values are at some point processed to remove empty command lists from the list of changes (as it means that nothing changed). However, here we ignored the flag that stated whether we want all field values or just what has changed. This commit takes the flag into account before removing the field's value. [1] https://github.com/odoo/odoo/commit/3e3a244e1afc4d74920a6302a14fa2590e8b6648 Issue reported in task~2352524 Model: account.move One2Many (A): account.move.lines Nested computed One2Many (B): tax_detail_ids Field triggering the onchange (C): tax_ids closes odoo/odoo#67679 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Co-authored-by: Géry Debongnie <ged@odoo.com>
2021-03-08[FIX] web: FieldMany2Many: link/unlink optionsAaron Bohy
Commit [1] altered the way the FieldMany2Many behaves with respect to 'create' and 'delete' options. Indeed, for many2many fields, adding or removing records doesn't mean "creating" or "deleting" records, as it is only about adding/removing records to/from a relation. This is completely fine and correct. Unfortunately, a feature has been lost in the process: it is no longer possible to state that a many2many field should be editable but should not allow to add (or remove) record to the relation. This commit fixes the issue by adding two new options: 'link' and 'unlink' for that purpose. [1] https://github.com/odoo/odoo/commit/c98579d25af01c14df4baf57fb4652f3e7469096 opw~2466213 closes odoo/odoo#67358 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-03-05[FIX] web: correctly edit Many2ManyCheckboxes with 100+ valuesAaron Bohy
The Many2ManyCheckboxes widget displays all values that could be in the many2many relation, with a checkbox indicating whether each value is in the relation or not. It is designed to be set on fields where the comodel contains a few records (typically, we don't want to see dozens of checkboxes in the form view). This widget shouldn't be used on many2manys with a large comodel, as we have better tools to handle them (like a tree view). We deal with extreme cases (when the widget is, by mistake, set on a field where the comodel is huge) by using the name_search limit of 100: at most 100 checkboxes are displayed. Before this commit, this extreme situation wasn't correctly handled. If there were in the relation records that weren't displayed (because they weren't inside the 100 limit), then, editing the value by (un)selecting a checkbox would automatically remove all non displayed values from the relation. This commit ensures that we keep in the relation all values that aren't displayed. Issue spotted when working on opw~2439041 closes odoo/odoo#67373 X-original-commit: fa324ef071952d749f635f878bee0fa462cfa011 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-05[FIX] web: can edit many2many_checkboxes with 40+ valuesAaron Bohy
Before this commit, if the widget "many2many_checkboxes" was set on a field with more than 40 values in the comodel (i.e. more than 40 checkboxes displayed), (un)selecting a checkbox that wasn't in the first 40 checkboxes crashed. This was due to the default x2many limit of 40: we only created a datapoint for the first 40 values, whereas we could have up to 100 values to process (name_search server-side limit). Note that this limit of 40 had no other impact than limitating the number of records processed by the BasicModel, the maximum number of checkboxes displayed being ruled by the name_search server-side limit. This commit ensures that all values returned by the server (at most 100 when this message is written) are processed and can be edited as expected. opw~2439041 X-original-commit: be5e5bc49cb9744c26ca75dcee74caf11447f250
2021-03-04[FIX] web, web_editor: customize colorpicker inputs from web_editorYounn Olivier
Styles for the hex and rgba inputs from the color picker were modified on directly from the web module, which means that for a specification concerning only the frontend colorpicker, the backend colorpicker was also changed. This commit reverts the changes that were made and only applies the new style for the website editor. Related to https://github.com/odoo/odoo/pull/65249 closes odoo/odoo#67156 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
2021-03-04[FIX] web: properly apply onchange in some casesGéry Debongnie
A previous commit (8dbd1efef899fb637acca3c318ae99cb23838b8f) fixed a part of the basicmodel that used _.each to iterate on an object with field names as keys, which does not work when a field is named "length". To fix it, I simply used a native for ... in statement. However, I missed the fact that there was a second 'return' statement in the body of the closure given to _.each, so the onchange method returned prematurely. The fix is to simply use the continue statement in that case. closes odoo/odoo#67228 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-03[FIX] web: prevent traceback when pressing TAB in color_picker widgetGéry Debongnie
The color_picker widget, that can be seen for example in the track form view for event tracks, had an issue: if the user clicked on it, then pressed TAB, a traceback was displayed. The problem comes from the fact that the color picker widget inherits from FieldInput, but is not a fieldinput, so many expectations made by the FieldInput code do not hold, such as the code run when handling navigation (by TAB and such keypress). Because of that, the code in _onNavigationMove crashed, because it expected an input. Since this is a bug fix, I simply disabled the navigation in that case, so no crash happens. Sadly, this widget has still a big issue: it clearly does not work as most users would expect: pressing TAB or arrows should update the selection. But this would be a more complicated refactoring, for a bug which is clearly not critical, therefore this commit implements the simple and safe solution. Also, we disable the focus outline to minimize the wrong expectation. Seeing them kind of implied that one could update the selection with the keyboard. Note that the widget color_picker was moved from another addon to web/, without any tests nor documentation. OPW 2467369 closes odoo/odoo#67174 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-03-03[FIX] web: issue with field named "length"Géry Debongnie
The underscore (_) library has a bug in which the _.each method does not work with object which contains a "length" property. This is because it does look for that key and if it is a number, it will assume that it is an array with that length value. Nicely done... If that length value is set to 0, then it will just do nothing, since it thinks that it is dealing with an empty array. Note that if the value is set to an object, _.each is smart enough to notice that it cannot be an array, and will do the correct thing in this case. Usually, our _.each calls are safe, since we usually iterate on arrays, or on object with safe keys, or on object with values that cannot be a number. But there was 2 unsafe calls in basic_model, which leads to strange bugs: some code is skipped, and the form view is then confused. The motivation for this fix is the fact that onchanges are not applied at all, if there is a length field set to 0. To fix this, we can just avoid using _.each. Note to every Odoo JS developers reading this: new Odoo code should avoid using the _ and $ libraries, because we do not really need them, and we want to keep our dependencies to the strict mininum. OPW: #2465808 closes odoo/odoo#66126 closes odoo/odoo#67138 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-25[FIX] web: translate "View ..." titleMartin Trigaux
And remove code content
2021-02-17[FIX] web: correctly close confirm dialogAaron Bohy
Let's assume the following scenario: - have an action in target new (e.g. a form view) - in the dialog, have an action/object button with confirm attribute - when clicking on that button, a confirm dialog opens - if validated, the following action returned by the server is again an action in target new Before this commit, the confirm dialog remained in the DOM. This issue occurred because it's parent wasn't correctly set (wrong use of `this`), so when the first dialog was destroyed, the confirm dialog wasn't automatically destroyed in turn. OPW~2440712 closes odoo/odoo#66345 X-original-commit: 2016fe31af970976775c9df160a31abfbec742ba Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
2021-02-17[FIX] web: fix issue of notebook page with invisiblity modifierMohammed Shekha
before this commit: when there is only one page in the notebook tag and there is a boolean field in form to show/hide that notebook page based on invisibility attrs, if we toggle boolean field notebook hides, that's OK but when we toggle boolean field again then notebook page is displayed but it is not active and due to that content of notebook page is not displayed. after this commit: when there is only one page in notebook and it has attrs for invisibilty, when we toggle boolean field to hide/show notebook page then notebook page as well as content is toggled. task-2449053 closes odoo/odoo#66338 X-original-commit: a0b5ecd344d6ac79d8e4d194cfabf3d639259c73 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-18[FIX] web: client report action mounted called twiceRomeo Fragomeli
Before this commit, the 'mounted' method of the ControlPanel in the client report action was called twice. It happened because the client report action updated the ControlPanel before being actually mounted, so mounted was called once when the traceability report was mounted, and once when the update was applied. Ideally, this should not be an issue (this isn't an issue with owl). However, in Odoo, we mix layers of Owl Components and legacy widgets. In these situations, the above scenario isn't properly handled (and can't be). As a consequence, in mobile (enterprise), it crashed because an handler bound in mounted (thus twice) was only unbound once. This commit avoids the issue as the update was actually useless. Steps to reproduces (Mobile): * Go to Inventory (Stock) * Open the "burger menu" * Select "Products" -> "Products" * Select one product in the list * Click on the "Forecasted" ("stat button") * Select one "SO line" (sale order) to go to the form view * Go back to the previous view using breadcrumb * Optional: Go to another app if the screen can't scroll (e.g. go to Sales) * Scroll the view => Bug closes odoo/odoo#65522 Related: odoo/enterprise#16033 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2021-02-17[FIX] web: do not display cover images in sample dataMohammed Shekha
Before this commit, in sample mode, cover images might be displayed in kanban views. It isn't what we want as those images are real images from the database, not sample ones, but randomly linked to the sample records (the id of many2one fields is randomly generated). This commit tweaks the SampleServer to always set many2one fields pointing to model 'ir.attachment' to false. task-2368505 closes odoo/odoo#66350 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-15[FIX] web: mock active_test for search and search_readLucas Lefèvre
The support for "active_test" context key has been introduced in c2918c1 However, the context key is ignored in many mocked ORM methods (if not all). This commit adds support for the `search` and `search_read` methods. Note: this is done to easily write some tests in odoo/enterprise#16363 and it might be usefull to test futures features (or fixes) using this context key. closes odoo/odoo#66190 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-17[IMP] web: list multi-edit: discard, cancel then saveMohammed Shekha
In a list view that allows the multi edition, select several records, edit a field, and 'click' on Discard. In the confirm dialog, click on 'Cancel'. The row is still in edition and the changes are still there. However, before this commit, clicking on 'Save' did nothing. The reason is that the 'Save' button is fake. Typically, clicking on it triggers a 'field_changed' event, thus saving the selected records. In this above scenario, the changes have already been notified, so nothing happens when the user clicks on 'Save'. This commit fixes the issue by storing the last 'field_changed' event, and re-triggering it when necessary. This isn't the cleaner way to handle that scenario, but it is the simpler, so we go for it in stable. In master, it would be nice to rework the multi edition feature with this scenario in mind. task-2376233 closes odoo/odoo#66045 X-original-commit: 18ed619baeda06f071779da00177beee01f8a896 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>