summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields/relational_fields.js
AgeCommit message (Collapse)Author
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
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-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-25[MERGE] forward port branch saas-11.3 up to 387d5cff90bChristophe Simonis
closes odoo/odoo#30566
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
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
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-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-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
2018-11-06[MERGE] forward port branch saas-11.4 up to dc35de9d30bChristophe Simonis
2018-11-05[FIX] web: re-evaluate column_invisible after onchangeMohammed Shekha
Let's assume a form view with field A and B (a one2many list), with a column with attrs column_invisible depending on A. If the user sets A manually, everything works fine (the column is hidden/shown directly). However, if A is updated by an onchange (e.g. depending on the number of rows in B), it doesn't. This rev. fixes that issue. Related to Issue: 1851451 Co-authored-by: Priyanka Kaakdiya <pka@odoo.com>
2018-10-22[MERGE] forward port branch saas-11.4 up to 3c108977c1eChristophe Simonis
2018-10-17[MERGE] forward port branch saas-11.3 up to 0de06a41326Christophe Simonis
2018-10-01[IMP] product,(website_)sale: Product configurator default_get cleanupAurélien Warnon
Targets commit d3530eb07e24278117ab396ecb86a59deecc312d Purpose ======= [Follow up AL review] Removed the default_get override in the sale_order_line model. - The default values to create records are now specified by pefixing them with "default_" in the JS. That will use the built-in framework method, which is more simple/clean. - The "list_editable_renderer.js" file for the product configurator was removed and its content is now merged within the SectionAndNoteListRenderer. Updated fields: - [sale_order_line in sale/sale.py] "product_no_variant_attribute_values" to "product_no_variant_attribute_value_ids"
2018-09-25[IMP] framework js: improve X2Many 'CREATE' operation to handle multiple recordsAurélien Warnon
Purpose ======= The 'CREATE' operation lacked the possibility to handle multiple records. The 'context' parameter is now an array of dict that contains the context for each new record. This is usefull when you want to create multiple records into a list in a single call. Please note that the 'default_get' is still called once for each record in an async way.
2018-09-25[IMP] product,(website_)sale: Move product options configurator into sale moduleAurélien Warnon
Task #1871557 Purpose ======= - Configure a product from a sales order as easily as in the ecommerce The backend uses the same template as the frontend to configure a products and its options - Display optionnal products of optionnal products in the "sale options" section - Allow adding exlusions to some combinations of the product and/or to some combinations of the optionnal and accessory products Specification ============= PHASE I 1. Improve the "Add to cart" with optional products - When you add an option to cart, move the product to the cart & show the options of this option - Don't open the option wizard if no option available (in case this module becomes generic, it's better to skip this step when it's not needed) - Display the options right under their related product in the cart 2. Do not allow to add the product as an optional product for itself Why ? - No functional sense - Creates issues in the add to cart wizard 3. Exclude some attribute combinations within the product or with related options and accessory products - Rename VARIANT PRICES button -> CONFIGURE VARIANTS - When you click this button and select a value, open form view rather than inline edition - Form view of variant values: - Attribute - Value - HTML Color Index - Attribute Price Extra - Not Compatible with: o2m tab with 2 fields: Product AND Attribute Value (of this product) [m2m tag selection] - in any new line, autocomplete the current product by default - Tooltip: A list of product and attribute values that you want to exclude for this product's attribue value. Also applies on optionnal and accessory products. 4. New option to configure a product in a sales order line - This option is only visible if the corresponding option is activated in the sales settings - It opens a wizard to select a product template, configure related attribute values and select optional products (based on frontend view) - Attributes not compatible with other selected attributes should not be selectable - Must work like in the frontend
2018-09-25[FIX] web: improve automatic creation of new lines in x2many in formsVincent Schippefilt
This commit fixes a few issues with the previous implementation of the automatic addition of new lines in x2many inside forms 1. Before this commit, when there is a change of mode in a formview `edit` -> `readonly` -> `edit`, there may be some cases that mistakenly and automatically opens a modal. This case occurs in a form view with a x2many field whose 1st inner focusable element opens a modal (e.g. "Add an item"). In `edit` mode: 1. Open this modal from the x2many 2. Close the modal 3. Change mode to `readonly` 4. Change mode to `edit` > the same modal is automatically open. This is due to the tracking of the last activated field that persists after a change of mode. Since the last activated field in the 1st `edit` is the x2many, it is granted the focus at the beginning of the 2nd `edit`, which automatically opens the modal. This commit fixes the issue by resetting the tracking of the last activated field when there is a change of mode. As a result, at the beginning of the 2nd `edit`, the focus should always be on the 1st field. 2. Before this commit, if the focus was moved out of the form (to a modal for instance) then back, the form would re-activate the last field, which is the x2many and would re-add a new line. This behavior is not correct and now going back from a modal to a form does not add a new line. Co-authored-by: Alexandre Kühn <aku@odoo.com>
2018-09-21[ADD] partner_autocomplete: Added autocomplete on partners fieldsAntony Lesuisse
For Name field or M2O, gives a list of companies Data comes from Odoo IAP Service
2018-09-17[FIX] web: x2Many: remove deadlock situationAaron Bohy
This rev. is similar to db9b91ff, but treats the x2many case. Calls to the 'commitChange' function of renderers must not be done inside a mutex, mainly since 241704536, as they could end up in a deadlock. For x2manys, it was actually the case in practice in Inventory > Operations > Inventory Adjustments > Create > select 'One product only' > select a product > try to edit the real quantity in the editable list > focusout > deadlock. The reason why the deadlock occurred in this view and not in, e.g. sale.order, is due to the presence of the field_float_scannable widget. Indeed, the barcode engine intercepts input events and manually re-triggers them. As a consequence, the 'change' event is not triggered on the field, and it does not notify the environment of its new value by itself, until the field x2many asks it to commit its value. Note that this might be an issue as well, as onchanges are thus not triggered. Task 1878254
2018-09-17[FIX] web: navigate in editable list with custom controlsAaron Bohy
Rev. f241441 recently added the possibiliy to define custom controls (instead of the single 'Add a line') in editable list views. However, it didn't take into account keyboard navigation. Suppose that the focus is on the field preceeding the list, and the user clicks on TAB, the code assumed that there was only one control, and focused it. However, when there were several control, the last one was focused (which is typically the less common one), and there was no way to navigate to the others. This rev. focuses the first control by default, and allows to navigate through controls with RIGHT and LEFT. Pressing TAB still moves out of the list, to the next field. Note that i'm not happy with this fix, as the logic doesn't seem to be in the right place. Indeed, the notion of controls is the concern of the editable list, not the x2many field, so the list should handle this logic by itself. Unfortenately, this is not that easy to change, as for now the list doesn't even know that we are navigating to/from its control(s), until we click on it/them. Changing that will be for later, in master. We also did a linting pass on the concerned code. Task 1878254
2018-09-11[FIX] web: FieldMany2ManyTags: fix broken colorpickerAaron Bohy
Before this rev., if the user clicked on a tag to open the color picker, and then clicked in the dropdown, but not on a color, the color picker closed itself, and it was no longer possible to open it again. This issue came with the migration to BS4 and its following fixes. As the color picker is now a classical BS dropdown, it closes itself automatically, so we don't need to manually close it on focusout. Task 1878254.
2018-09-07[MERGE] forward port branch saas-11.4 up to d78f23df848Christophe Simonis
2018-09-07[MERGE] forward port branch saas-11.3 up to 4850fb08385Christophe Simonis
2018-09-05[MERGE] forward port branch 11.0 up to 213759b03e5Christophe Simonis
2018-09-05[FIX] web: BasicController: remove deadlock situationAaron Bohy
This rev. removes a deadlock situation that could *theoretically* occur, but that was actually hard to reach in practice. Before saving a record (e.g. in a form view), all field widgets are asked to commit their value (in case they wouldn't have notified the model yet, e.g. because the user just changed them). For instance, let's assume that the user fills an input field, and then triggers the save. In practice, by triggering the save, it will force the widget to notify the model of its new value (because it looses the focus). This is also the case using keyboard navigation, as it actually simulates clicks. So when the widget is asked to commit its value right after, it has nothing more to commit. This is fortunate, because if it actually had something to commit, we would end up in a deadlock ('commitChanges' is executed in a mutex, and if the widget triggers a new value, '_applyChange' is called, and is executed in that mutex as well). In fact, executing 'commitChanges' in a mutex is useless, as '_applyChange', which is called when a widget has something to commit, is already executed in the mutex. So this rev. removes the use of the mutex in 'commitChanges'. Doing so broke several Many2One tests, because they wrongly relied on the presence of the mutex for scenarios where the user quick creates a relational record, and then directly saves (before the relational record is actually created). We thus handled that usecase properly to make the tests pass. Task 1878254.
2018-09-03[FIX] web: tab selects first many2one entry without triggering spurious createlen-odoo
Suppose you select a customer for a sale order. You type the beginning of his name "think", and a name_search is triggered which finds matching results, with first result "Think Big Systems". There are three ways to select it: click, enter or tab. Now there can be a warning set on this customer ("Bad client, only accept cash", or "good client, offer discount"). In that case, clicking on tab would trigger the onchange displaying the warning, but it would also set floating to true, which means a dialog to create client "think" would appear. This happens if the onchange is delayed, and thus the call to reset the floating state is triggered only after the focusout completed, instead of before. Coauthored with @aab-odoo opw 1866619 opw 1874475
2018-08-27[FIX] web, *: use correct DOM for m2m tagsqsm-odoo
* mail, calendar - Fix traceback when clicking on a tag without color field (introduced in recent changes) - Properly allow to delete tags on firefox (a button obviously cannot contain another button) Closes https://github.com/odoo/odoo/pull/26547 Thanks to @hbh-odoo
2018-08-22[FIX] web: allow o2m navigation to work from required inputsSébastien Theys
In a one2many, pressing ENTER or TAB from a required input (of type text or char) that is on the last editable column of its line would fail to navigate to next line. The issue was that the validation of the required field would happen before the change to its value was actually applied. This commit fixes it. PR: #26430 Task: 1869469
2018-08-20[FIX] web: restore many2manytags colorpicker dropdownDeep Patel
Bug revealed with BS4.
2018-08-17[IMP] web,various: Add 'Remove' button to view dialogs opened from x2m fieldsDharmraj Jhala
Currently, to remove link of x2m field from any record, sometimes there's no way. For example, if we are on mobile and open any Quotation, it's linked quotation lines are automatically converted in kanban, and there is no way to delete a line from that quotation. However, in some of the manually designed kanban, there is special 'x' for removing / unlinking x2m record, for example, Contacts of Partner. This commit makes the behavior more consistent. During edition (mobile and desktop), if a view dialog is opened on click of x2m field, it will have one 'Remove' button (based on user rights) on right side of dialog footer, allowing users to delete / unlink the record. Moreover, in mobile, the modal is opened fullscreen, with sticky header and footer. Related Task# : 31641 Closes PR #15857 Co-authored-by: Mohammed Shekha <msh@openerp.com>
2018-08-17[FIX] web: no_open in field options no longer workingSimon Lejeune
example: <field name="product_id" options="{'no_open': True}" readonly="1"/> This has been broken by rev. 43d21dd9c due to misplaced parentheses (an empty object in javascript being truthy).
2018-08-14[ADD] account: import vendor bills files from dashboardLaurent Smet
This adds a button to import several bills from the accounting dashboard: will create a new vendor bill for each, with the file attached to it. That file will be visible in the chatter (in enterprise) and allow easilly completion/encoding of it. This task also comes along with the import/export of xml files attached to the PDF files created from the invoice report. Was task 1859277 Was PR #26339