summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/relational_fields.js
AgeCommit message (Collapse)Author
2019-09-09[REF] web: add public API to open the selectCreateDialog of a many2manywan
Part of task 2005972 It is used in account_asset, when the o2m field is hidden and at the end of the form, but we need the user to see it at the beginning of the form closes odoo/odoo#36315 Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
2019-08-30[MERGE] forward port branch 12.0 up to 52f6e38cea8Christophe Simonis
2019-08-29[MERGE] forward port branch saas-11.3 up to ede253f1b2eChristophe Simonis
2019-08-29[MERGE] forward port branch 11.0 up to d61873ac4a3Christophe Simonis
2019-08-23[FIX] web: selection: required, option present but disabledLucas Perais (lpe)
Before this commit, a field selection which was required did not have an empty option ref: 4dfabb8f7adde06a7936502af61534c9958ed4f7 This is fine, but overlooked the fact that modules can modify the required attribute, or even views can do it So, we may end up in a situation where the field is required but set to false This configuration is problematic, at least for the timezone selection field (see OPW) After this commit, the empty option is just not visible note that `disabled = True` would not work because val is not accessible Because of commits: - 4dfabb8f7adde06a7936502af61534c9958ed4f7 for the selection feature - d77ce4c2a92c1da48150e4e84b714dd93f64847d overriding the required attribute of tz in res.user form OPW 2057913 closes odoo/odoo#35989 Signed-off-by: Lucas Perais (lpe) <lpe@odoo.com>
2019-08-28[IMP] web: remove m2o from supportedTypes in selection widgetMohammed Shekha
currently widget selection is not working in m2o in editable list view and to fix this issue it need a lots of changes to make it work properly, i.e. make '_fetchSpecialRelation' use correct domain for each record, batch requests as much as possible, also make all '_fetchSpecial...' work in the list case. So to avoid major changes remove supportedTypes from selection widget so user can not tempted to apply selection widget on many2one field. task-1871698 closes odoo/odoo#33485 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-09-11[MERGE] forward port branch saas-12.3 up to 50e571acf7cChristophe Simonis
closes odoo/odoo#36491 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-08-23[IMP] web: list: keep columns width when adding recordsAaron Bohy
Mainly, when adding the first record to the list, as this is when we switch from forcing the column's widths (when there is no data), to letting the browser optimally divide the available space. Some other cases had to be handled, like the multi edition.
2019-08-23[IMP] web: editable list: column's widthsGéry Debongnie
This rev. refines the way we compute column's widths in editable list views. When there are displayed records, we let the browser compute the width of each column (which is thus optimal with respect to the content), and we then freeze those widths s.t. it doesn't flicker when we switch a row in edition. When there is no record, we keep the former heuristic based on absolute and relative widths (depending on field types). However, we set the same weight for all fields having a relative width (i.e. all but boolean, date(time) and numeric), such that the remaining space is evenly distributed between them. Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-08-09[FIX] web: use correct avatar field for many2many_tags_avatar field widgetJigar Patel
The issue has occurred after rename image fields https://github.com/odoo/odoo/commit/58a2ffa26f1a3b0f9630ce16d11b758d18e20a21 closes odoo/odoo#35596 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-08-14[MERGE] forward port branch saas-12.4 up to 98a55917a60Christophe Simonis
2019-07-30[FIX] web: add view id in optional fields local storage keyDavid Monjoie
Since the renderer does not know the view id, we moved the local storage key computation up to the basic controller, which makes more sense since the renderer is supposed to be inert. The _processColumns function had to be moved in willStart however, since it now needs the controller to respond to the trigger_up and the controller is not present during the init of the renderer. closes odoo/odoo#34051 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-08-09[IMP] web: m2o/m2m SelectCreateDialog will now open kanban viewMohammed Shekha
- many2one widget in mobile will open kanban view instead of listview when records needs to be selected - Add support of "kanban_view_ref" on many2x fields: For many2one fields, this specific kanban view will be opened when you click on this field. Note that in desktop, the behavior stay unchanged: 'Search More' will open the tree view. For many2many fields, this specific kanban view will be opened when you add a record in mobile. - Add support "selection_mode" in kanban views. This boolean is set to true when you want to use a kaban view to select a record instead of open a record. "selection_mode" is now passed in qweb_context to allow developers to use t-if='selection_mode' in kanban views to show or hide elements; buttons, dropdowns, anchor tags are not necessary when selection_mode is enabled. So those elements can be hidden based on this condition. Useful when kanban view is opened from m2o in mobile environment. Task ID : 1924779
2019-08-07[IMP] web: add new many2many_tags_avatar field widget to show avatar with tagsJigar Patel
2019-08-07[IMP] *: fix typos in commentsmreficent
closes odoo/odoo#35404 Signed-off-by: Martin Trigaux (mat) <mat@odoo.com>
2019-06-05[REF] *: removes datas_fname from ir.attachmentThanh Dodeur
This commit removes the field `datas_fname` from `ir.attachment` as it was unnecessary and most of the time the duplicate of `name` or `url`. Task #1909865 closes odoo/odoo#32976 Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
2019-07-29[IMP] base: Configure document layoutJulien Mougenot
The onboarding modal for setting up the few base fields of a company has now been moved to a wizard It is accessible from the general settings, but also in the onboarding section of sale and account modules. The following company settings are editable with that wizard: - Set report **layout**: The user can chose the overall look of the report. The current choices are : *Standard* (default), *Background*, *Boxed* and *Clean*. - Set company **logo**: Changes the company logo. - Set report **colors**: The user can set the primary and secondary colors of the report through a newly added widget allowing to pick a custom color. When changing the **logo**, colors are automatically set to its most dominant colors. > A "Reset colors" button also triggers the color calculation. - Set report **font**: Changes the overall font of the report. Only Google Fonts are used for enhanced compatibility. - Company **tagline**, also called "header" - **Footer** - **Paper format** - Report **preview**: A mockup of a final report Automatically updates when changing **layout**, **logo**, **colors** or **font** Co-authored by: Julien Mougenot <jum@odoo.com> closes odoo/odoo#33863 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: Lucas Perais <lpe@odoo.com>
2019-06-26[IMP] web: hide "Remove" button in FormViewDialogPratima Gupta
When we open any x2m record (in a FormViewDialog), there is a "Remove" button to delete/unlink the opened record from parent. This button is placed besides "Discard" button and it creates little confusion in some cases. For example, in list view, there's already a bin / 'x' icon depending on the field type using which people are used to delete/unlink the record. And when they open a record, they might accidentally click "Remove" button instead of "Discard". To avoid this, now we won't show "Remove" button when we open record from x2many list view. However, we have to keep this button in case x2many of kanban as there's no other way to remove the record. task-1886913 closes odoo/odoo#34333 Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
2019-05-22[ADD] web: Allow to add multiple records in m2m_tags widget.Prakash Prajapati
Before this commit when user want to add multiple record at that time they only allow to add one record at a time. After this commit user can add multiple record from search more wizard. Added function _getSearchCreatePopupOptions so that it can be overridden in FieldMany2ManyTags, options for FieldMany2ManyTags will differ, like FieldMany2ManyTags SearchCreateDailog should have multi record selection, Many2ManyTags' SelectCreateDialog should display record other than selected This commit is related to task id: 1945912 closes odoo/odoo#32453 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: Mohammed Shekha <msh@openerp.com>
2019-05-03[IMP] web: multi-line many2one: only highlight first lineAaron Bohy
Rev. a3489be33 removed this feature to fix a bug (when the single line many2one, e.g. a product, is too long and displayed over several lines). However, we (fp) still want this for res_partner many2ones with show_adress. This rev. re-introduced the feature without re-introducing the bug. closes odoo/odoo#33139 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-04-30[IMP] web: close dropdowns on scrollJulien Mougenot
Dropdown from many2xxx and datepicker widgets now close on scroll to allow access of background information when scrolling. Related to task #1929483 closes odoo/odoo#32836 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com>
2019-04-02[IMP] web: editable list: table-layout: fixedAaron Bohy
This rev. changes the layout of *editable* list views to a fixed layout. This means that we are now responsible of the width of each column. To do that, we associate with each field type a factor, and the higher the factor is, the larger the column will be (w.r.t. the others). This default value can be overriden in the arch. The fixed layout allows to remove the absolute positionning of widgets inside editable lists (done in the next commit). Part of task 1915702 Co-authored-by: Martin Geubelle <mge@odoo.com>
2019-04-02[IMP] web: list: editable grouped list viewsRavi Gadhia
This rev. enables the editable feature in grouped list views. Part of task 1915702 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
2019-03-05[MERGE] forward port branch 11.0 up to 27081bf6f5fChristophe Simonis
2019-03-04[MERGE] forward port branch saas-15 up to 1f1fa35c072Christophe Simonis
2019-03-25[MERGE] forward port branch saas-12.2 up to 230ad8c381eChristophe Simonis
closes odoo/odoo#32088 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-22[FIX] web: Add support of button type object on One2Many KanbanRecordRomain Estievenart
Before this commit, there were a crash if you tried to add an optionnal product in a new sale order without saving it. Apply same logic as in the ListRenderer: buttons with type="object" are disabled for no saved yet records, as calling the python method with no id would make no sense. To avoid to expose this logic inside all Kanban views, we define a specific KanbanRecord Class for the One2many case. This could be refactored to prevent from duplicating this logic in list and kanban views. Original Task ID: 1945006 closes odoo/odoo#31695 Signed-off-by: Adrien Dieudonné (adr) <adr@odoo.com>
2019-03-11[MERGE] forward port branch saas-12.1 up to 2b3296bbf8bChristophe Simonis
2019-03-08[MERGE] forward port branch 12.0 up to c023d0784f2Christophe Simonis
2019-03-13[MERGE] forward port branch saas-12.2 up to c9f832d9f03Christophe Simonis
closes odoo/odoo#31790 Signed-off-by: Christophe Simonis <chs@odoo.com>
2019-03-06[REF] web: adapt code after jQuery updateVincent Schippefilt
Part of task 1896658 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Christophe Matthieu <chm@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: David Monjoie <dmo@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com> Co-authored-by: svs-odoo <svs@odoo.com> Co-authored-by: Vincent Schippefilt <vsc@odoo.com>
2019-02-26[FIX] web: search more in many2one: filter on idsAaron Bohy
Let's assume a many2one field with a lot of possible values. The user clicks on 'Search More...'. In the opened dialog, only 160 records are available (their ids have been obtained with a name_search, with the optional text the user could have typed in the many2one input). Before 4cd379cf, that extra domain on ids was removed automatically as soon as the user interacted with the search view in the dialog. This was especially useful when there were more than 160 records. However, this was rather an happy coincidence than a designed feature. From 4cd379cf, the ids selection was added to the initial domain of the list, so they couldn't be removed from the domain afterwards. The user was thus stucked with its preselected 160 records. This rev. doesn't restore the former behavior, but rather improves the current one, as follows: - when there is no text in the many2one input (i.e. no value to filter on), we bypass the name_search, s.t. all records are available in the dialog - when there is some text in the input, we perform a name_search (as before) to get a list of record ids, and we add a special filter to the search view in the dialog (the filter on those ids), s.t. the user can remove it if he wants to access the remaining records. - finally, the limit is now set to 320, to mitigate the problem Issue reported on the saas-12.1 migration pad. closes odoo/odoo#31232
2019-02-28[MERGE] forward port branch saas-12.1 up to f9d3b5b7dfeChristophe Simonis
2019-02-13[IMP] web: force activeActions to be booleanAaron Bohy
The docstring says they are boolean, but they actually aren't (e.g. edit="0" in the arch would lead to activeActions.edit=0). This could cause issue if that value is used to toggle a class with jQuery, as in this case the flag argument *must* be a boolean.
2019-01-31[MERGE] forward port branch 12.0 up to cb8fefa8999Christophe Simonis
2019-02-06[IMP] web: expose FieldX2Many relational fieldsRomain Estievenart
Expose to public the variable FieldX2Many. Task ID: 1910385 closes odoo/odoo#30512
2019-01-23[MERGE] forward port branch 11.0 up to 984a99611eeChristophe Simonis
2019-01-23[MERGE] forward port branch saas-15 up to 3cba1862d44Christophe Simonis
2019-01-25[MERGE] forward port branch saas-11.3 up to 387d5cff90bChristophe Simonis
closes odoo/odoo#30566
2018-12-07[REF] web: move ControlPanel inside controllers/actionsGéry Debongnie
This branch introduces a large-scale reorganization of the component tree generated by the web client. The short version is that now, the control panel is a child of the view controller and no longer a sibling. Graphically (and simplified), we go from this: webClient / | \ ... ... actionManager / \ controlPanel viewController / \ to this: webClient / | \ ... ... actionManager | viewController / | \ ControlPanelController / \ CPRenderer CPModel The motivation is that this work moves the code where it should be. Before this commit, it was kind of weird to have code in the controllers to render buttons outside of their root node (in renderButtons). Also, the action manager had to take care of coordinating search view states between view transitions. So, this work simplifies the code. It also makes it easier to extend. We see day after day that Odoo needs to take care of more complex UI needs, and in many cases, these needs were quite difficult to implement (we prefer spaghettis in our plates, not in our code). The changes in this branch should open the way to implement these features. For example, - it will now be easy to add the possibility of views (for example, the search view or a new ControlPanel view) to add custom buttons (of type action or object) in the control panel. - Another need will be to serialize/ restore the state of the search view across action boundaries (needed by the dashboard). - Another example is the possibility for views to customize easily the presence/absence of sub menus (filters/groupbys/favorites/ time range/...) - Another need is an easier way for views/client action to customize their control panel. This commit also contains a large rewrite of the search view (so it is more inline with our architecture and easier to maintain). Part of task 1893568 Co-authored-by: Aaron Bohy <aab@odoo.com> Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com> Co-authored-by: Martin Geubelle <mge@odoo.com>
2018-11-28[MERGE] forward port branch 11.0 up to bb6f6c57f97Christophe Simonis
2018-11-29[MERGE] forward port branch saas-11.3 up to c0eef427111Christophe Simonis
2019-04-24[IMP] web, *: add a description to generic widgetsJuhil Somaiya
A `description` key has been added on AbstractField and all generic field widgets ; it is used to display a more user friendly name (both in the webclient and in Studio). Non-generic field widgets have an empty string as description. Related task 1918327 closes odoo/odoo#30131 Signed-off-by: Martin Geubelle (mge) <mge@openerp.com> Co-authored-by: Mohammed Shekha <msh@openerp.com>
2019-04-23[IMP] web: enable drag&drop in ungrouped kanban viewsVandan Shah
With this rev., the resequencing feature (with drag and drop) that was already available in list views is now available also in kanban views having a field with widget="handle". This works for main as well as x2many kanban views. Some code handling the resequencing has been moved from the list components (controller and renderer) to the basic ones, so that the logic is shared between list and kanban. Task 1902808 closes odoo/odoo#28581 Signed-off-by: VincentSchippefilt <VincentSchippefilt@users.noreply.github.com> Co-authored-by: Mohammed Shekha <msh@openerp.com> Co-authored-by: Aaron Bohy <aab@odoo.com>
2019-04-12[MOV/IMP] web, mail: update attachment widget and moved the common scss code ↵jpr-odoo
from mail to web with this commit, we have updated the attachment widget view same as like chatter attachment view moved the common scss code from mail to web for many2many_binary widget, which is used for attachment and update test case according to the widget Task ID: 1930087
2018-11-26[FIX] web: propagate can_create into the search popupLucas Perais (lpe)
When creating a SO line and clicking on search more for product_id Before this commit, every user had the button "Create" to create a product.product After this commit, only user in groups that actually can create a product have the button OPW 1910371 closes odoo/odoo#28924
2019-03-06[MERGE] forward port branch saas-11.3 up to 3e54704e669Christophe Simonis
2019-02-27[FIX] web: avoid crash when clicking on colored m2m in listMartin Geubelle
With the BS4 update, a traceback occured when clicking on a m2m tag using colors in a list view. When using colors on m2m tags, the badge was wrapped inside a `dropdown-toggle`. However, there is no `dropdown-menu` by default (it is only rendered in FormFieldMany2ManyTags when clicking on the `.dropdown-toggle`, hence the traceback. The `dropdown-toggle` class is now only set if necessary. Task 1925313 closes odoo/odoo#31445
2018-10-16[MERGE] forward port branch 11.0 up to b29b545fe84Christophe Simonis
2018-10-12[FIX] web: don't allow reference widget to be set on char fieldslen-odoo
The reference widget is expecting a models list as selection attribute in the field declaration. It does not exist in the case of the char field. Support for char fields was added to allow for external identifiers, but it only works in readonly. As a consequence, it tracebacks in Edit mode when used in studio. We thusly remove char field from the list of supported fields. opw 1892602 closes odoo/odoo#27708