summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/components
AgeCommit message (Collapse)Author
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-02-01[FIX] web: Auto close dropdown is brokenRomain Estievenart
Steps to reproduce: 1. Go to Project App 2. Open and edit a task 3. Click on Customer => search more 5. Click on "Filters" 6. Click on "Group by" => The "Filters" and "Group by" dropdown are open at same time => bug Since odoo/odoo@e4f87710e16357f24f388159a7b1e82eccda598a, we added a way to prevent bs and owl dropdown to be open in the same time. But when the web-editor is present, the CSS selector used to match the opened modal ("search more" in this case) conflicts with the DOM created by the web-editor (modals identified by the classes: .web-editor, .note-picture-dialog, .note-link-dialog, .note-help-dialog). To avoid this conflict, this commit uses a more restrictive CSS selector to match only the first (active) opened modal (as web-editor doesn't attach its modals at the root of the body). closes odoo/odoo#65274 Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-12-04[FIX] survey, web, web_editor, website, website_form: Prevent invalid date ↵Achraf (abz)
stock.picking What are the steps to reproduce your issue? 1. Install "stock" 2. Go to Inventory/Inventory Overview/Internal Transfer 3. Create new record and set manually a date with year < 1000 like "0008-10-10 18:35:00" 4. Save What is currently happening? An error arises when saving the record, and it is then no longer possible to reopen the records or any view containing it. This also prevents us from correcting the date to no longer have the error Why is this happening? The root cause is an inconsistency in `strftime` for years < 1000 [1, 2]. To take it into account, a zero-padding is needed in the DateTime parser. How to fix the bug? The missing padding is added. However, such dates lead to problematic behaviors in Python: ``` DT_FORMAT = "%Y-%m-%d %H:%M:%S" new_date = "0008-02-05 18:10:10" datetime.strptime( datetime.strptime( new_date, DT_FORMAT ).strftime(DT_FORMAT), DT_FORMAT ) ``` This raises: ``` ValueError: time data '8-02-05 18:10:10' does not match format '%Y-%m-%d %H:%M:%S' ``` As of today there was no reported business cases where dates with year < 1000 would be necessary. Therefore, we limit the range to years >= 1000. [1] https://bugs.python.org/issue13305 [2] https://docs.python.org/dev/library/datetime.html#strftime-strptime-behavior opw-2408260 closes odoo/odoo#62818 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-11-03[FIX] web: datepicker inside a dropdownRomain Estievenart
Steps to reproduce: 1. Go to Project 2. Filter > Add custom filter > Last Updated on 3. Click on the date field and use the date picker to change the value 4. The dropdown is closed and you lost your selection => BUG This bug was due to a conflict between owl and bs dropdown (e4f87710), to prevent this bug, we added a check to ensure there are no open bootstrap calendar inside the current dom. Note that if you click outside the dropdown, the datepicker is already closed when you go through this code. It means that the datepicker will not be present in the DOM anymore and the dropdown can be closed too. opw-2373573 closes odoo/odoo#61258 X-original-commit: 73dfc1f7a8e2197fcdd4053ec57c260576593a15 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com> Signed-off-by: res-odoo <res-odoo@users.noreply.github.com>
2020-10-28[FIX] web: DropdownMenu autoclose behavior should match BootstrapRomain Estievenart
Before this commit, with an opened DropdownMenu component, when the user clicks on a Bootstrap's dropdown the DropdownMenu doesn't close. This issue is due to a conflict between the global click listener registered to close the DropdownMenu and the listener registered by the Bootstrap dropdown: the last one prevents the event from bubbling up to the `window` element and be handled by the first one. This commit fixes it by enabling the `capture` flag on the DropdownMenu global click listener, giving it the opportunity to handling it properly and close the DropdownMenu. Note: this commit also fixes an issue when a dialog is opened from a DropdownMenu (like the favorite's delete action) and prevents it from closing in the background (e.g. when the dialog is still opened). opw-1879566 closes odoo/odoo#60909 X-original-commit: e4f87710e16357f24f388159a7b1e82eccda598a Signed-off-by: Pierre Paridans <pparidans@users.noreply.github.com>
2020-10-06[FIX] web: hide action button when no actionPriyanka Kakadiya
Before this commit: the action menu registry items were rendered regardless of their inner state. The problem is that these item components can choose not to render themselves, leading to a blank dropdown menu if no other item was present. To fix this, the "getProps" function of the registry has been altered to act as validation: the item will not be rendered if the return value is falsy. The function has also been made asynchronous to allow RPC calls. This solution is still flawed and hides a bad design choice which is to register components and not items or item getters; this API is too complex for its use case(s) and adds pointless depth to the DOM. The shape of the registry should be simplified in an improvement in master. closes odoo/odoo#59254 Task: 2325587 X-original-commit: 45c7d881a5d130f6b3222749c8c87b6c6b45e910 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Julien Mougenot <jum@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-10-06[FIX] web: Disables pager on enterJulien Mougenot
Before this commit, the pager component would only quit the edit mode if its value changed when hitting Enter. Now, when pressing Enter while the pager value did not change, it will leave the edit mode and trigger a "pager-changed" event regardless. Task 2318738 closes odoo/odoo#59277 X-original-commit: a3197283d52bfda399ce45b7d5a52406885336d0 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-09-16[FIX] web: prevent dropdown closing on mouseupHardik Prajapati
Before this commit, selecting the whole content of the custom filter input and releasing the cursor outside of the dropdown closed the dropdown. With this commit, the dropdown is kept open in this situation. task - 2276544 closes odoo/odoo#55660 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-07-29[FIX] web: datepicker get correct database formatJulien Mougenot
Before this commit, the format used by both date and datetime picker components depended on default props which are evaluated on module loading. This was an issue because the "time" module did not have time to load and fetch the correct database value, hence using the default ones. Now, the format is evaluated on component instantiation, giving enough time to the "time" module to load. Task 2307258 closes odoo/odoo#55113 X-original-commit: 792b565a65a8c9f65bf13e94f30b88913f2bfa7f Signed-off-by: Paul Morelle <madprog@users.noreply.github.com> Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
2020-07-28[IMP] web: remove min date limitation of year 1900Harpritsinh Sisodiya
Before this commit, user could not selecta a date before year 1900. This was an historical limitation due to python < 3.2 that didn't support dates before 1900. After this commit, user can select any date, user can select any date from 01/01/0001. taskID: 2166761 Fixes #41788 Closes #43055 closes odoo/odoo#51406 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com> Co-authored-by: Mohammed Shekha <msh@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-06-29[FIX] web: update action on archive/unarchiveHardik Prajapati
Before this commit, when archiving a record through the action menu, the 'Archive' link was not updated to 'Unarchive' and same when unarchive was clicked, the link was not updated to 'Archive'. After this commit, when archiving a record through the action menu, the 'Archive' link is updated to 'Unarchive', same way when unarchiving a record link is updated to 'Archive'. This commit also introduces a new prop 'closeOnSelected' to the Dropdown component, to specify whether the dropdown should be closed when an item is selected, and makes Action Menu dropdown closed on item selected. task-2251739 closes odoo/odoo#53835 X-original-commit: dc5d02ade7747c74c31566c74932ef45c30e9356 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com>
2020-06-04[REF] web: force dropdown menu icon through getterJulien Mougenot
Before this ref, the dropdown menu got his icon directly from his props. This means that any inheriting class had either to define its icon with the 'default_props' key or to have its parent giving it in the props. Now, the icon is retrieved from the props via a getter (same as title and items) and can be overridden to force a fixed icon on the class.
2020-05-04[IMP] web: ControlPanel: remove dropdown caretspka-odoo
Part of task 2234547 closes odoo/odoo#49793 Related: odoo/enterprise#10059 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Co-authored-by: Mohammed Shekha <msh@odoo.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2020-04-02[FIX] web,*: Remove undefined domain in action menu contextLucas Lefèvre
*google_drive Go to a user form view and click on "Change Password" in the action menus. => traceback `Cannot read property 'constructor' of undefined` This error is raised because `active_domain: undefined` is in the context and py_eval can't handle an undefined value. closes odoo/odoo#48915 X-original-commit: 69694c627be42e3d068e48be14026493628a3a8d Signed-off-by: Aaron Bohy (aab) <aab@odoo.com> Signed-off-by: lul-odoo <LucasLefevre@users.noreply.github.com> Co-authored-by: aab-odoo <aab@odoo.com>
2020-03-31[ADD] web: add CustomCheckbox owl componentMichael Mattiello (mcm)
This commit adds an owl component for the Odoo custom checkbox. task id: 2193996
2020-03-30[IMP] web: selection in list viewsAaron Bohy
This commit allows the user to apply actions to all records matching the current domain in list views. It also ensures that the user is aware of the set of records actually selected. The number of selected records is now displayed in the control panel, and the user can, with an additional click, select all records matching the current domain instead of the ones of the current page. Task 2185145
2020-03-17[FIX] web: action menus default select_allJulien Mougenot
Before this commit, the context sent by an action performed by the action menu could hold an 'undefined' select_all key, which would cause the context evaluation to crash. Now, the select_all key is defaulted to 'false' and does not crash in actions that do not provide it. closes odoo/odoo#47745 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2020-03-13[REF] web: Adapt views/actions to new control panelJulien Mougenot
Some web actions/controllers/viewsl have been adapted to properly instantiate the newly refactored control panel and update it accordingly. We needed to adapt the starting mechanism of actions and controllers to ensure that the control panel instantiation did not delay the loading of any widget. Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-03-13[REF] web: Control panel OwlJulien Mougenot
Refactoring of the control panel with the Owl framework. The MVC structure of the control panel has been changed to a 'component <-> model' relationship. As such: - Removed the old control panel: view/model/controller/renderer - Created a new Owl Component (ControlPanel) - Created a new class: the Model (an Owl Store did not fit here) and a newly designed ControlPanelModel extending it Refactored all inner subcomponents, including: - Pager - ActionMenus (peviously SideBar) - Filter menu > Custom filter item - Group by menu > Custom group by item > Removal of groupby_menu_mixin (and refactored graph controller in sibling commit) - Time range menu - Favorite menu > Custom favorite item > Moved the favorite menu registry to the favorite_menu file - Search bar > Removed and splitted auto-completion dropdown logic between the new SearchBar Component (descriptions) and to the new ControlPanelModel (domains). The templates (all in web/base.xml) have been adapted to the new standards. Most of the DOM structure remains unchanged with some occasional improvements (replace hiding with not rendering, removed pointless wrapper divs, etc.). Part of task 2196029 Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
2020-01-06[ADD] web: Custom File InputJulien Mougenot
New component: the custom file input. Its purpose is to define a input of type file with a custom trigger (button, link, etc.). Its construction is the following: - attributes: behaviour of the actual input (route to call, multifile, allowed extensions etc.) - inner template: the trigger that will fire the upload prompt when clicked Once a file has been uploaded, the component will emit a 'uploaded' custom event containing the files. closes odoo/odoo#38423 Related: odoo/enterprise#6031 Signed-off-by: Géry Debongnie (ged) <ged@openerp.com>