summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views
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[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-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-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-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-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-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: 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-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: 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-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-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-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>
2021-02-17[FIX] web: list: correctly evaluate groupby modifier with m2oAaron Bohy
Let's assume a <groupby> node in a list view containing a button with an invisible modifier referencing a many2one field, e.g. ``` <tree> <groupby> <field name="m2o" invisible="1"/> <button string="do it" attrs="{'invisible': [('m2o', '=', False)]}"/> </groupby> </tree> ``` Before this commit, the m2o field was correctly read, but it's value wasn't processed by the model, so the modifier wasn't correctly evaluated. Issue reported on PR https://github.com/odoo/odoo/pull/65316/ closes odoo/odoo#66287 X-original-commit: bbaeeb76bbef4ea371d3db5821af91bf1fe9ac4f Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-15[FIX] web: multiedit in a grouped list view: enable fetchBatchedM2O and ↵Lucas Perais (lpe)
References Have grouped list with reference a m2o or a reference field Select some records, edit them Before this commit: the names of the reference fields and m2o disappeared That was because the saveRecords function did not take into account a grouped list manual forward port of #65999 After this commit: it works as expected closes odoo/odoo#66043 closes odoo/odoo#66140 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2021-02-15[FIX] web: list multi edit: prevent force saveLucas Perais (lpe)
Have a list with multi_edit enabled Have a widget boolean_toggle displayed on some field Select some records to be in multi edit mode Before this commit, the record on which the boolean toggle button was clicked was written and then the multi edit feature was triggered and wrote on all the records The first write is unnecessary and counter intuitive After this commit, only the write with all the multi edited records is done
2021-02-11[FIX] web,mail: Call on_attach_callback when appending contentJulien Mougenot
Before this commit, the form renderer would call "on_attach_callback" only when the whole _render process was over. The problem was that this process is asynchronous and this callback should be invoked as soon as the widgets are appended. As such, any asynchronous operation is performed before appending the content in a new function "__renderView". Task 2346540 closes odoo/odoo#60791 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-02-03[FIX] web: invisible currency stay invisible in calendarNicolas Lempereur
In #47607 we allowed to show the monetary field symbol in calendar but it seems a part was missing in forward-port. opw-2214445 closes odoo/odoo#65458 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-02-03[FIX] calendar: currency in popover fullcalendar V4Nicolas Lempereur
The update of fullcalendar (ebce7719b) in 14.0 made #45881 not working (they both happened in same month). opw-2214445 closes odoo/odoo#65451 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2021-01-28[FIX] web: Show create button on multiEdit + unit testAchraf (abz)
What are the steps to reproduce your issue ? 1. Install project 2. Open any project 3. Switch to list view and display by Stage 4. Open categoryA and select some records 5. Open CategoryB What is currently happening ? The button create is not displayed What are you expecting to happen ? Don't hide create button opw-2423701 closes odoo/odoo#64136 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-28[FIX] web: nested x2many with no widget and onchangesNicolas Lempereur
Let's assume the following situation: in a form view, there is a one2many field A displayed as a list (non editable). In the list, there is another one2many field B displayed with no widget (it basically displays "X records"). In A's form view, B is also displayed, but this time as a list. There is an onchange on the main form view that adds a line in A, (and simply sets B to [[5]], i.e. 'No record'). Before this commit, if the user opened the newly added sub record in A, and clicked on 'Add a line' of B, it crashed. The cause of the crash was that the wrong viewType was used to create the new (default) record in B: it used the original viewType, which was undefined (B is displayed with no widget in A's list). With this commit, we use the viewType of B that is used to edit it, in this case 'list'. In the slighlty different scenario where B is displayed with widget many2many_tags in A's list, there were no crash, but wrong fieldNames were sent to the 'default_get' RPC. As a consequence, default values for fields in B's list were potentially not loaded. opw-2422806 closes #64793 closes odoo/odoo#65157 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2021-01-15[FIX] web: dropdown remains always open on MobileRomeo Fragomeli
Before this commit, on pivot view when a user adds some groupBy the dropdown menu remains always open. This commit restore the same behaviour like on desktop. Steps to reproduce: * Open an app with a Pivot view * Select the Pivot view * Add one "groupBy" * The dropdown remains open => BUG Task ID: 2439742 closes odoo/odoo#64613 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2021-01-06[FIX] web: editable list: can unselect rowAaron Bohy
Since commit [1], it is no longer possible to unselect a row in a one2many editable list if there is an html field in the form view. The reason is that there is a '.modal' element (several actually) in the DOM of the html field. This element is considered as an opened dialog by the list renderer, which is wrong. This commit refines the selector that determines whether there is an opened dialog or not. [1] 7d04ec7cca4f355295a06c1ce6f112b6cc533c87 closes odoo/odoo#64127 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-01-05[FIX] web: list: keep line when click in m2o dropdownMohammed Shekha
Before this commit, in editable list views with a many2one, when the user clicked inside the many2one dropdown, in the padding above the first item or below the last item, the dropdown closed itself and the row was removed (if it wasn't dirty yet). This commit fixes that issue by ignoring clicks at those specific spots. Task 2377864 closes odoo/odoo#63993 X-original-commit: dd40745dfdc98e82142e64ca58c0c976f6ad8d97 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-05[FIX] web: fix optional dropdown hide behind listview tableMohammed Shekha
before this commit: when you have o2m which has optional fields and optional field dropdown is bigger and o2m does not have records and when you open optional dropdown it hidden behind o2m table. The reason is optional dropdown is child of table. after this commit: put dropdown as child of listview.$el so it is no more child of table so when it is opened it is displayed on top of listview table, here we also have to calculate position of optional dropdown as it is no more child of table element, so we have to set left position based on table width and if language direction is rtl then dropdown width. task-2370860 Closes #62681 closes odoo/odoo#63698 X-original-commit: c026b322dd0e22e86e82e917e722a9f579978b3a Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2021-01-04[FIX] web: editable list: do not discard row on m2o blurAaron Bohy
Let's assume an editable list with a many2one field. The user types something in the many2one and then clicks outside (mousedown, not mouseup, and thus click, yet). A dialog opens to ask the user if he wants to quickcreate a record. Before this commit, the dialog and the row disappeared as soon as he released the click, because the click was considered by the list renderer as an "external click", and the row was discarded (alongside the many2one it contained). Task 2411029 closes odoo/odoo#63697 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2021-01-04[FIX] web: translate report buttonMartin Trigaux
The button "Group By" and "Measures" were untranslated opw-2421769 closes odoo/odoo#63977 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2020-12-30[FIX] web: calendar_controller: Adapt date to server format on updateNasreddin (bon)
Issue - Install "Time-Off" module - Set user language to "Arabic" - Open "Time-Off" Traceback raised. Cause On update, JS send to backend date in arabic. Python 'datetime' library does not manage arabic date. Solution Convert date format for the "server" on js-side. In this case, it will also translate arabic numbers. Also, adapt "dateToServer" to handle any format. opw-2421268 closes odoo/odoo#63833 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
2020-12-21[FIX] web: SampleServer: round float valuesMohammed Shekha
before this commit: when field is float type it display too much decimal precision value, it should be fixed to 2 precision for sample data. after this commit: float field will display 2 decimal precision value. task-2318503 closes odoo/odoo#55987 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Kamesh Patel <kat@odoo.com>
2020-12-08[FIX] web: don't update the list view if not neededRomeo Fragomeli
Before this commit, an event was triggered even when no change occurred. Steps to reproduces: * Go to Document * Change to list view * Go to app switcher * Select another app that has enough content to be able to scroll * Scroll the view => Bug Task ID: 2347584 closes odoo/odoo#63012 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com> Co-authored-by: Michaël Mattiello <mcm@odoo.com>
2020-11-08[FIX] web: remove formating from event titleMartin Trigaux
When copy-pasting text from rich text, the content may contain unwanted formating instructions. Unsure it's escaped to avoid propagating the content.
2020-11-30[FIX] web: Unable to create a new record with warning messageNasreddin (bon)
Issue - Install Sales - In Sales > Configuration > Settings -> Enable "Sale Warnings" - Go to Sales > Orders > Customers - Pick a customer/company - Go in Edit mode and go to "Internal Notes" tab - Switch "Warning on the Sales Order" from "No Message" to "Warning" and add any warning message then save - Press the "$ X Sales" smart button - Create a new Quotation - Validate the warning message - Go back to the previous menu (using the breadcrumb) or save the quotation - Create a new quotation The quotation form editor does not appear. Cause If we use the breadcrumb (or save then create), it will call the `_reload` function (instead of `load` when the form view hasn't been opened yet). In this case, creating a new record, it will call `_makeDefaultRecord` without setting `allowWarning` param to true (like it is done in the ref. commit bellow). Solution Set `allowWarning` param to true before calling `_makeDefaultRecord`. related commit : https://github.com/odoo/odoo/commit/a41db9a2cf410bb233b021651a5633180eaddf18 opw-2374857 closes odoo/odoo#62534 X-original-commit: 5c8101102f999cfac6aec7658b98e376d4ed0596 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com> Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
2020-11-27[FIX] web: prevent kanban quick create from closing when modal is openedAurélien Warnon
The kanban quick create is meant to stay open if a click event is triggered within a modal, which was working for most cases before this commit. However, there are some specific tricky cases when the behavior is incorrect. Issues were mainly observed when using the many2one widget inside a quick create card. When typing something into a many2one widget and then focusing out of it, the widget has a built in feature that asks the user if he wants to create the record (based on options and necessary create rights). This implies to open a modal asking the user to create or discard his input. When you combine a many2one widget IN a kanban quick create card, then type something in the many2one and click outside of the quick create, it triggers BOTH the focus out event of the many2one and the click event of the kanban quick create that verifies if it should be closed. This click event creates a race condition but the following behavior happens most of the times: - The many2one 'focusout' is triggered first, creating the modal to confirm record creation (see FieldMany2One#_onInputFocusout) ; - The click event is registered second, triggering the quick create check to see if it should be discarded (see RecordQuickCreate#_onWindowClicked) ; - The click is technically registered outside of the modal since the modal was not created yet. This behavior differs a bit between browsers: - On Firefox the click event correctly targets the actual element that was clicked (ex: another kanban card) ; - On Chrome it varies between the actual element (same as Firefox) and sometimes the raw 'body' element. - The quick create card will then incorrectly consider the click as outside of any condition to keep itself open and will close and destroy itself ; - Which in turn destroys the FieldMany2One and the record creation modal ; - (If you look carefully on the screen you can see a slight flicker when that happens). During all my testing, only one condition will stay consistent when focusing out of the FieldMany2One by clicking somewhere else: the body element will always have the "modal-open" class by the time the click event is triggered in the RecordQuickCreate. This is why relying on the condition that an element exists with the "modal-open" class to avoid closing the quick create card provides reliable results and seems to suit all necessary conditions and behaviors. Task 2388450 closes odoo/odoo#62560 X-original-commit: 4930871701da2e2792e73ae3941f336046876f0e Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2020-11-27[FIX] web: BasicModel: nested x2many and unknown fieldsAaron Bohy
Consider the following situation: - have a form view with an x2many field displayed as a list - the x2many field has a form view that contains an x2many field, which isn't in the list - for that x2many field, we can also open a form view to see/edit the related records. As the x2many field isn't in the list, when we open a subrecord, we modify the fieldsInfo to add the information about the x2many field we didn't know before. Doing so automatically applies raw changes that we might have stored earlier (from onchanges) for that field, because we couldn't apply them before knowing the type of that field. Before this commit, the function that applies the raw changes was called recursively on the dataPoint and all its children (thus on the x2many list datapoint), which produced a crash as this function is designed to work on dataPoints of type record. Actually, calling it on sub datapoints is useless, as it properly works recursively, and applies raw changes on x2many fields itself when necessary. This commit ensures that we don't call this function on list datapoints anymore. Closes #62334 OPW 2389991 closes odoo/odoo#62399 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>
2020-11-18[FIX] web: race condition with x2many control panelAaron Bohy
The ControlPanel has been converted in Owl [1], and the code using it has been adapted accordingly. However, in the FieldX2Many, we didn't properly wait for the ControlPanel to be updated (an update of the ControlPanel was synchronous before owl, and is now async, like every Owl renderings, as it waits for the nextAnimationFrame). As a consequence, we might have tricky issues because the mounted hook of the control panel might be called multiple times for a single call to willUnmount later on. In mobile, we bind a global event handler (on scroll) in mounted, and unbind it in willUnmount, so we had leftover event handlers, that crashed when called after the ControlPanel was destroyed. Note that even if the issue popped in mobile, calling mounted on already mounted Components isn't a good idea, and this should be fixed anyway. The issue could be reproduced for instance in FieldService (with collaborative pads activated in Project), in mobile, by opening a task in Edit mode. Then, you might get a traceback by scrolling after having discarded the edition Here is a description of what technically happened: - when clicking on Edit, all widgets (including the FieldX2Many are destroyed and re-instantiated in 'edit' mode). - the pad widget directly triggers a field_changed event which causes a reset of the FieldX2Many (i.e. 'render' is called again) - the FieldX2Many detects that it already has a renderer (and a ControlPanel) so it updates them - it first updates the renderer, and when it's done, it updates the ControlPanel BUT doesn't wait for its promise, so the promise returned by that call to 'render' in FieldX2Many is resolved before the ControlPanel is actually updated - note that at this point, all thoses new widgets are not in the DOM yet - when all widgets are ready, the renderer patches the view (i.e. the former content is removed from the DOM, and the new one is attached into the DOM). As soon as this is done, the renderer calls 'on_attach_callback' on its children, including the FieldX2Many, which leads to a call to 'mounted' on the CP. - then, just before the nextAnimationFrame, Owl complete the rendering of the CP, and detects that it is now in the DOM (it wasn't at the beginning), so 'mounted' is called a second time, will cause the issue described above. This commit fixes the issue by properly waiting for the CP to be rendered in the FieldX2Many. However, this required on cascade changes: - Form view renderings with a FieldX2Many are now *really* async (+- 16ms), meaning that the user can easily trigger concurrent renderings by, e.g. clicking quickly several times on 'Edit', 'Save' or 'Discard'. Concurrent renderings are properly handled so to prevent this from happening, we disable the buttons and re-enable them when the rendering is done (like already done in [2]) - in the FieldX2Many, '_updateControlPanel' was called at several placed, but we never waited for it. As this method was originally sync, its calls have probably been naively adapted, whereas their should have been deeply rethought (for instance, as it is async, and we need to wait for it, we don't want it to be called multiple times sequentially when something happens). This commit does that work, i.e. we clean the places where this function is called such that it is (hopefully) never called sequentially twice. To do so, we changed a bit the spec of the pager in multi page, and we also fixed a paging-related bug. In a few words, here is what we did/do when adding a new row in the bottom of a full page: - before: tweak the count in the data to fool the pager and make it think that no new record has been added (so basically, let it display something wrong) - now: temporarily increase the pager limit so that the new record is displayed on the current pager, and the pager values are correct w.r.t. the displayed records. Some tests needed to be adapted accordingly. - By waiting for the ControlPanel when updating the FieldX2Many, a bunch of QUnit tests failed. Those tests have something in common: they spawn an X2Many (list or kanban theoretically, but always list in practice) containing a FieldBoolean (only field widget of /web converted in owl). When the FieldX2Many is updated, we update the renderer (i.e. re-renderer the FieldBoolean, so we have to wait for the nextAnimationFrame), and when this is done, we update the page (again, we have to wait for the nextAnimationFrame). So basically, we have to wait for two nextAnimationFrames to see the result in the DOM. For this, we added a new test util which basically does a nextTick ('owlCompatibilityNextTick'), and called it everywhere it was necessary. When everything will be written in Owl, we could get rid of this util and its calls. [1] https://github.com/odoo/odoo/commit/fbf347498f1cc7b74ef373179b7bcae201715c24 [2] https://github.com/odoo/odoo/commit/39f08950d6e20460e3a20a5b9c33e4ddf66dce78 closes odoo/odoo#61593 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2020-11-16[FIX] web: improve the hit box of the kanban quick_createAurélien Warnon
When the user clicks outside of the kanban quick create element, it's closing itself automatically. However, the "hit box" of this behavior is not entirely accurate and clicking on the very edge of the box would also close the element. This commit fixes the click behavior and allows clicking anywhere inside the quick create element. Task 2373095 closes odoo/odoo#61761 X-original-commit: 72ed82489daa2b82628dfdefeb06262e17e6548e Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.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-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-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-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: 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>