summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/views/form_relational_widgets.js
AgeCommit message (Collapse)Author
2017-04-11[REF] web, *: redesign all JS viewsGéry Debongnie
This commit introduce a full redesign of all JS views. We started basically from scratch. The goal was to unify all the various views under a common framework, to make them testable, to make then usable in different conditions (in studio, or in the frontend), and to make our lives easier. Some important points are: - we introduced new coding guidelines (camelCase, 80 chars width, ...) - we have a brand new testing framework (still QUnit based) - kanban view moved to the web addon - calendar view (formerly web_calender) moved to web as well - the tree view was removed - all new code should be documented We hope that this code is the start of a new era for the Odoo web client, we want to have a high quality codebase, well documented, well tested, well designed. Work done by the framework team: mostly aab, ged, chm, dmo, qsm
2017-03-28[MERGE] forward port branch saas-14 up to 2f68e9e93a1Christophe Simonis
2017-03-21[FIX] web: correctly check editable list validityqsm-odoo
The editable list has a `is_valid` method which checks that all the records it contains have valid data. The problem is that it was considering that all the records in the `dataset.cache` were part of the x2x field the editable list is working with. This is wrong as the `dataset.cache` can contain information which are not part of the editable list anymore. See the commit which introduced the use of the `dataset.cache`: a9d20d9fa04b1dbb350663652e0996e258ac6d31 This was causing issues with rare cases of an editable list which contains another editable list (even invisible) which was sharing common information with its parent editable list. opw-710627
2017-03-01[MERGE] forward port branch saas-14 up to eddefc9948bChristophe Simonis
2017-02-17[FIX] web: create="0" in many2many list viewsDenis Ledoux
The revision dd657c42f7cbac01294ef794bf0e697ed495c722 intended to give the possibility to add an existing record to a many2many list even without the `create` access on the model of this record. This is accepted by the ORM, as there is no need of the create right on the model, only the write on the source model on which the many2many field is. The revision has as unexpected side effect to remove the possibility to manually set `create="0"` on the tree of a many2many field, to hide the "add an item" of the list view. As this last feature is more important, we therefore revert this. We will provide another solution for the above issue. We think about forcing what the view definition says, so if you set create="1" on the view, it will display the "add an item" link in any case, even if you do not have the access right to do it. This would allow to display the link for the above case, and in case you actually do not have the access right, and this is an error in the view definition, you will have an access error raised anyway. opw-708310
2017-02-10[MERGE] forward port branch saas-14 up to be9dfb331f9Christophe Simonis
2017-02-06[FIX] web: undefined variable eAaron Bohy
2017-02-06[FIX] web: FieldMany2Many List: allow to add items if create="0"Aaron Bohy
One can add an item in a Many2Many without creating it, so the action should be available. However, if the create action is not allowed, there is no 'Create' button in the SelectCreateDialog.
2017-01-23[MERGE] forward port branch saas-14 up to 6c4389df41fChristophe Simonis
2017-01-23[MERGE] forward port branch saas-11 up to b9374d5c215Christophe Simonis
2017-01-23[MERGE] forward port branch 9.0 up to 0997a1cf6dcChristophe Simonis
2017-01-19[FIX] web: display warning message for o2m modalNicolas Lempereur
Be a little less strict when not showing o2m list view warning so if the o2m is not editable (a modal is open instead of editing inline) we still show warnings. Also have warnings over modal overlays so they can be used for modals. opw-702333
2017-01-09[IMP] web: allow to upload multiple files in `many2many_binary` widgetYannick Tivisse
2016-11-22[MERGE] forward port branch saas-12 up to d1fddd2Christophe Simonis
2016-11-22[MERGE] forward port branch saas-11 up to 659fb5dChristophe Simonis
2016-11-22[MERGE] forward port branch 9.0 up to b73518fChristophe Simonis
2016-11-22[FIX] web: do not cancel edition on o2m list when pressing EnterOlivier Dony
Rev. 3f7d350fe21d9e2afb35a9ce3e2652940e3f259d1 introduced auto-cancellation of the edit mode when the user clicks outside the edited line. The unfortunate downside was the auto-cancellation of the edit mode also when the user presses ENTER while the line is not valid. This is especially annoying when using barcode scanners to fill in values, as scanners usually send an ENTER keystroke at the end of the input sequence. When a many2one field is focused this event will often occur before the autocompletion popup has a chance to open. At that point the line is considered invalid, and the edition mode is cancelled! If no field is considered dirty yet on the line this simply drops the whole line, otherwise it will open a navigation confirmation popup. Both results equally prevent the use of barcode scanners. This patch makes sure the edit mode is only cancelled when the user indeed clicked outside the line, and not for other cases where save() is requested, such as an ENTER keystroke.
2016-11-08[MERGE] forward port branch saas-12 up to 6386037Christophe Simonis
2016-11-08[MERGE] forward port branch saas-11 up to c19f546Christophe Simonis
2016-11-08[MERGE] forward port branch 9.0 up to b795755Christophe Simonis
2016-11-07[FIX] web: correctly saves last change in wizards with many2omanyChristophe Matthieu
With this change, form_relational_widgets will wait for the 'web.ListEditor' module to be loaded before patching the list view. This is particularly important for wizards containing and editable list view. Note that to achieve this, I had to fix a horrible hack in session.
2016-11-04[FIX] bus,im_odoo_support, web*: fix various memory leaksChristophe Matthieu
* Tip are never destroyed when change view mode * unbind methods * mail: memory leak with unbind methods * web: memory leak because 'ui-autocomplete' is never destroyed * web_editor: memory leak for wrong unbind on destroy * web: memory leak: must remove fileupload handler * bus: memory leak: correctly debind handlers on window in bus.Bus * remove handlers on switch buttons and views $buttons * remove handlers on breadcrumbs * web: memory leak: correctly debind handlers * im_odoo_support: memory leak: remove fileupload handler odoo_support Note: part of this commit was actually authored by aab
2016-10-17[FIX] web: one2many displayed even if no data.Jeremy Kersten
Before this commit, the one2many widget was not displayed if no data. That make some form (notebook) empty while the user don't click en edit to see the widget appear. Eg: stock picking 'Initial Demand' tab Courtesy of @ged-odoo
2016-10-11[FIX] web: X2Many list views: don't display action buttonsAaron Bohy
2016-09-28[MERGE] forward port branch saas-11 up to 34186fdChristophe Simonis
2016-09-26[MERGE] forward port branch saas-10 up to faaacabChristophe Simonis
2016-09-26[MERGE] forward port branch 9.0 up to e318a96Christophe Simonis
2016-09-26[FIX] web: can't saved X2Many list editable if a deleted record is invalidChristophe Matthieu
The widget test if all lines are valid to save the view, but the test include the removed lines (eg: required field).
2016-07-25[MERGE] forward port branch saas-11 up to 7ae5121Christophe Simonis
2016-07-19[FIX] models, mail, *: fix access action crash due to one / multi conversionThibault Delavallée
get_formview_action and get_formview_id are methods used notably in a redirection called from a mail controller used in notification emails. Those methods however are defined as cr, uid, id and are interpreted as api.one when called by a new-api style method. With modules being converted into the new API, those methods are called as api.one and the result is encapsulated into a list. To avoid having to take the first element of the returned list we decided to simplify the call chain and migrate the methods as multi methods, using ids instead of id. Various addons have been updated accordingly. A temporary support of ids being an int / long has been added to avoid conflict with calls using id (for example if javascript is not updated).
2016-07-04[MERGE] forward port of branch saas-11 up to d4d09dfChristophe Simonis
2016-06-29[FIX] web: pager minimum on next/previous recordChristophe Simonis
Since the deduplication of web addons (977db823c7c84e9edc7c8cf8384eb9cf47275b3a), patch 9062c01c0298dd254197e5100ff9f23725f7e46f (freshly forward-ported) is now useless. Apply odoo/enterprise@26adf4fe2cc89743e31f5540ef5de803185930a2 couterpart.
2016-06-28[MERGE] forward port of branch saas-11 up to 7153077Christophe Simonis
2016-06-28[FIX] web: re-add now usefull variable `self`Christophe Simonis
2016-06-28[MERGE] forward port of branch saas-10 up to 6d51bceChristophe Simonis
2016-06-28[MERGE] forward port of branch 9.0 up to 3e15b86Christophe Simonis
2016-06-28[MERGE] forward port of branch saas-6 up to e68ed41Christophe Simonis
2016-06-27[FIX] web: pager page on next/previous recordDenis Ledoux
When browsing a form with a one2many / many2many field with several pages, the one2many pager page was not reset when going to the previous/next record, while the next/previous record could not have multiple pages on its one2many/many2many, and the page on which the user was on the former record could not exist in the newly displayed record. Besides, even if the page does exist, there is no reason to display this new record X2many value from its first page. It's the case anyway when you edit/save, it comes back to the first page. opw-679092
2016-06-27[FIX] js: translations and string substitutionsMartin Trigaux
_('foo '+bar) does not work as `bar` is a variable with undefinied content during translation export (and variable content during evaluation) so a match will not be found. Also trailing spaces are stripped during synchronisation with transifex. The proper syntax would be _.str.sprintf(_t("foo %s"), bar) but to avoid breaking existing translations (need to reexport .pot) use the syntax _("foo ") + " " + bar that is more stable friendly. The 'No value found for the field...' string is not possible to be fixed without breaking the translations should be split at least twice. Write it the propre way directly.
2016-06-22[FIX] web: 2many race condition on fast click on Save / EditDenis Ledoux
For `this.viewmanager.active_view` to be set, the view manager switch mode must be completed, meaning the deferred returned by the function `switch_mode` must be resolved (see `this.active_view = view;` in `view_manager.js`, line 146) In a 2many field, the view manager `switch_mode` deferred is resolved when `is_loaded` of this field is as well resolved. Before this revision, clicking fast on Save then Edit of a vendor bills resulted to a JS error due to a race condition, because `this.viewmanager.active_view` was undefined when the field was not loaded / the view manager switch mode not completed. opw-678097
2016-06-22[FIX] web: FieldX2Many must use AbstractManyField is_false methodChristophe Matthieu
If the method return false, when a user write require="1" on a x2many field, the content is valid that there have none or a value. The method was overwrited for a visual change (display the field x2m in readonly mode when they are not value) but is_false is priority use to ensure datas.
2016-06-17[REF] web: move async_when to utilsGéry Debongnie
2016-06-03[REVERT] revert web: Navigation improvement in editable list view"Géry Debongnie
This reverts commit c43a97f353b76e211cad939a1c02c06e8ee724b7. If you use a setTimeout in your js code, you might want to have a serious look at what you are doing. You are almost certainly doing it wrong. If you chain a deferred with the number returned from a setTimeout, you definitely don't know what you are doing. If you try to fix editable list view by magically adding timeout, potentially inversing the order of execution, and without understanding how deferred works, it is clear that you are just changing stuff until your particular bug disappear in your particular case, and that you have no idea what other bugs you just introduced. Please study how deferred works, how the basic JS methods works, learn what setTimeout returns. Also, you might want to have a basic understanding of how and when expressions are evaluated. For example, if you cannot explain why a if statement cannot be replaced by a function, you might want to stop what you are doing and educate yourself.
2016-06-02[IMP] web: Navigation improvement in editable list viewRavi Gadhia
1/ On create new record focus field should select already existing value of field, So user doesn't have to remove the old value first and then enter new value. 2/ Avoid the double empty line creation when pressing enter step to produce 1 Menu Point of Sale > Configuration > Point of Sale switch to form view 2 Tick the box "Cash Control" , the one2many field will be visible 3 Press the "Tab" from keybord , control jumps to "Add an item" button 4 Press "Enter" from keyboad 5 You will see one extra line will be added..
2016-05-24[MERGE] forward port of branch saas-11 up to bb442fdChristophe Simonis
2016-05-23[FIX] web,base: m2o empty name resultsqsm-odoo
M2O use the autocomplete lib to display its content. The problem is that if a result is empty (or only composed of whitespaces), a divider is displayed in the dropdown. Commit 1d9f7d279a74aaf6aaf25f91e2313b23b4122827 was fixing this by only displaying non-empty name results... but it did not work as many models implement the name_search method the wrong way. The new solution is to add a default display for record values which are empty strings, at the right places in the webclient components.
2016-05-23[FIX] web: better blur handling in m2m in wizardsGéry Debongnie
Before this commit, many2many list views in wizards did not handle the blur event at all, which means that the last edited line was ignored. This is quite a large bug, but not really visible in our standard install, because we had no many2many in wizards. This commit add naive support for blur events. This is only intended to help the MRP team. A complete solution would probably involve moving most of the code in One2ManyListView to X2ManyListView.
2016-04-21[REF] web: stop duplicating webAaron Bohy
Avoid duplicating web addon in enterprise by extracting a common basis. Enterprise features stay in enterprise, but use that common basis. Mainly: - JS refactoring and linting - Conversion of .sass into .less split into multiple files - Templates cleaning and DOM simplification - Re-generation of web.pot, and update of .po files
2016-04-01[MERGE] forward port of branch saas-10 up to 2483327Christophe Simonis
2016-03-22[MERGE] Forwardport of branch 9.0 up to revision 87578177Martin Trigaux