Commit Graph

1749 Commits

Author SHA1 Message Date
Raphael Collet 2067a206ec [FIX] models: process onchange methods on new records in the order of the view
The onchange() on new records processes fields in non-predictable order.  This
is problematic when onchange methods are designed to be applied after each
other.  The expected order is presumed to be the one of the fields in the view.

In order to implement this behavior, the JS client invokes method onchange()
with the list of fields (in view order) instead of False.  The server then uses
that order for evaluating the onchange methods.

This fixes #4897.
2015-02-10 13:12:40 +01:00
Denis Ledoux 534d4e3e07 [MERGE] forward port of branch saas-3 up to a8fdc60 2015-02-09 17:58:28 +01:00
Denis Ledoux a8fdc60b88 [MERGE] forward port of branch 7.0 up to 1d76586 2015-02-09 17:57:39 +01:00
Denis Ledoux 1d76586a1b [FIX] web: context lang & active* in action buttons
This reverts rev. 9f9e7ef0e1

As explained in 9f9e7ef0e1,
if a field "lang" is present in the view, clicking in any action item
in the more menu leaded for the action title to be translated
in the lang value of the form, such as in the partner form.

9f9e7ef0e1 fixed the issue,
but has as side-effect to not update correctly the active* keys.
So, if "active_id" was used in the context of the action button,
and the active_id was set in the dataset context, for example
because you come from another form, trough another action button
(For instance, Customers > Opportunities > Logged Calls),
the active_id was not updated with the current id of the record.

opw-620293
opw-617321
fixes #3462
2015-02-09 17:53:11 +01:00
Olivier Dony 801a8b8fa9 [MERGE] Forward-port latest saas-3 bugfixes, up to c9b690f6b6 2015-01-29 13:54:13 +01:00
Olivier Dony c9b690f6b6 [MERGE] Forward-port latest 7.0 bugfixes, up to 4c2706d685 2015-01-29 13:50:51 +01:00
Denis Ledoux 4c2706d685 [FIX] web: saveas_ajax, correct filename when data passed directly
In cases where data is directly given to the saveas_ajax controller,
the filename was not correctly set, as no read method was performed.
(The read call is useless as the data is already avaiable in such a case)
In such cases, the filename must be given in advance

opw-626707
2015-01-29 12:51:47 +01:00
Martin Trigaux 4f14290670 [FIX] web: rounding of fields
round_precision expects a decimal (e.g. 0.01) while digits contains the number
of digits (e.g. 2)
replace by round_decimals
2015-01-21 16:04:29 +01:00
Adrien Peiffer 37e85a1e35 [FIX] view form: Use digits to round float values on client side 2015-01-21 10:38:32 +01:00
Denis Ledoux 87dd06c941 [MERGE] forward port of branch saas-3 up to 8c150c6 2015-01-15 14:43:32 +01:00
Denis Ledoux a692c6e934 [MERGE] forward port of branch 7.0 up to f406847 2015-01-15 11:49:28 +01:00
Denis Ledoux 275367581b [FIX] web: view is not always defined when a many2one is rendered
This rev. is associated with rev. 38aa984f31

closes #4660
2015-01-13 12:45:47 +01:00
Denis Ledoux 38aa984f31 [FIX] web: avoid rendering fields on one2many list validation
This rev. reverts 91911159f5

The above rev. was a good idea, except that internal_set_value expects the raw value, while the records attributes can be tuples(for instance, many2one are tuple(id, name) or list of command(one2many, many2many).

set_value must be use here, as all fields (js) override set_value in order to handle their value repr (for instance, many2one fields handle the tuple (id,name).

Besides, avoiding the re-render provides a huge performance improvment, as rerendering fields can lead to xmlrpc calls (for instance, re-rendering a many2one field implies calling the name_get method)

opw-620111
opw-622108
2015-01-09 18:10:38 +01:00
Denis Ledoux 4c1908088c [MERGE] forward port of branch saas-3 up to 879fca0 2015-01-06 19:00:08 +01:00
Denis Ledoux 879fca0856 [MERGE] forward port of branch 7.0 up to 9191115 2015-01-06 18:56:10 +01:00
Denis Ledoux 91911159f5 [FIX] web: editable list, no re-rendering on field validation
When adding several lines in an editable list (adding 7 lines to an invoice for instance), then clicking on the first row direcly after having filled the last line, the value of the cell sometimes had the value of the last line. Just a display bug, but still.

Using internal_set_value avoid the re-rendering of the cell, and solve the above issue

opw-620111
2015-01-06 18:53:33 +01:00
Aaron Bohy 3505dcce70 [FIX] web: view_form.js: radio buttons bug fix
Clicking on a checked radio button doesn't uncheck it anymore
2014-12-24 15:37:50 +01:00
Denis Ledoux 4a3e5df93a [FIX] web: autocomplete selection not hidden
Appending the autocomplete selection too close from the input field leads to display (hidden) problem in some cases (Many2one inside modals views, many2one at the end of a form view, etc.)

This is related to rev. e1cde4d038

closes #4268
2014-12-16 13:21:07 +01:00
Denis Ledoux a6212d2d20 [MERGE] forward port of branch saas-3 up to e11d1c2 2014-12-11 14:11:33 +01:00
Denis Ledoux e11d1c2b7a [MERGE] forward port of branch 7.0 up to db98434 2014-12-11 12:15:09 +01:00
Denis Ledoux e1cde4d038 [FIX] web: 558efacead not working for modals.
The above revision, which was already a patch for rev. a8f94a59cd, did not work properly for modals, like the use template many2one field of the mail.compose.message wizard.

We therefore append the ui-menu selection nearer to the input field.

$el.parent().parent() looks odd, but the goal is to append this selection ui just after the parent of the field, but as jquery ui autocomplete only accepts appendTo (and not after()), we append it to the parent of the field parent.

This fix has been verified for
 * many2one fields in classic form view (with or without sheets)
 * many2one fields in editable list view (embedded in form view or not-
 * many2one fields in wizard modals
 * many2one fields of the bank statement reconciliation widget
2014-12-10 21:45:28 +01:00
Denis Ledoux 558efacead [FIX] web: retro compatible patch for a8f94a59cd
Some views are not appended to the element oe_view_manager_body, such as client actions views.
For these cases, we append the element to the view manager element

Besides, we set the appendTo option of jquery ui autocomplete after a first initialization, because of a Jquery ui bug:
http://bugs.jqueryui.com/ticket/8858
2014-12-10 16:10:00 +01:00
Denis Ledoux a8f94a59cd [FIX] web: scroll handling for many2one selection
If the many2one selection height was too big (bigger than the browser page), it wasn't possible to see all options, because the body is set as overflow: hidden;

Moreover, if you opened a many2one selection and then scrolled the page, the selection moved with the scrolling, while it should be sticked to its input field
2014-12-09 14:41:26 +01:00
Denis Ledoux 9f9e7ef0e1 [FIX] web: user lang has the priority on partner lang
Potentialy, the timezone too.

On item action click (such as menus in More.. and Print..), the data in form view had the priority on user context (through the sidebar_eval_context)

Therefore, if a field "lang" was present in the form view (like in partner form), the web/action/load xmlrpc call was using the partner language instead of the user language.

Example of wrong use case before the fix:
 - Set the user language in French, then go to a partner form of a partner with English set as language
  - Click on any button of the partner form, such as the "Invoices" button, notice that the last item of the breadcrumb is in English, instead of Frenh (the user language)
  - Click on any menu opening a wizard in the More.. dropdown menu, notice that the wizard title is in English instead of French
  - Print any report from the Print dropdown menu, notice that the report file name is in English. If you print the same report for the same partner but from the list view, the report file name is in French.
2014-12-09 12:52:20 +01:00
Denis Ledoux eba1c56f97 [FIX] web: ensure one2many field destruction on button cancel
The destruction of one2many fields is forced with the event change:effective_readonly
This revision add the forced destruction for cancel(discard) button as well

Otherwise, one2many fields are not properly destroyed when hitting the button "discard" (from save or discard).
This can be problematic for one2many editable list views (such as invoice lines) if you discard while having a mandatory field not filled in the invoice line: You can't recreate an invoice, the one2many editable list is messed up

Use case: Create an invoice, create a line, leave the description, required field, empty. Then, discard. Then, click on create.

opw-616946
2014-12-08 15:42:24 +01:00
Denis Ledoux 9996668bad [FIX] web: get conditional user defaults
This is possible to set field conditional defaults, if the field has the attribute "change_default".
The defaults are set by the web client, by calling the method "get_defaults" of ir.values model, when the onchange is triggered on the field on which the condition is.

In 7.0, all onchanges were triggered clientside, one by one. On creation, the defaults of default_get method were pushed in the form, and then, as the values of the fields were changed (from null to the default value), all onchanges on which there was default value were triggered.

In 8.0, onchanges are performed server side, all at once. On creation, the onchange method is triggered by default (wether or not there is a default value for them), for all fields (widget param of method do_onchange of view_forms js is undefined, meaning the onchange is not triggered on a specific field, but on all fields). In such a case, we must call the get_defaults method of ir.values model for all fields (having change_default attribute), in order the conditional defaults to be set in the form view.
2014-12-05 17:41:11 +01:00
Denis Ledoux 45551cf78c [FIX] web: use mutex to wait for onchanges
This fix is related to c12a2e1d16

Mutex allow to wait sequentially for mutex
Besides, if one of the onchanges deferreds fails, it does not resolve the mutex until all deferreds of the mutex are resolved.

Besides, we now wait for the onchanges mutex between each field commited value (line 596) in case the commited value leaded to a new onchanges, that we should wait for before commiting the rest of the values.
2014-11-28 13:39:47 +01:00
Denis Ledoux d9e48bae42 [MERGE] forward port of branch saas-3 up to 7ab4137 2014-11-14 16:58:24 +01:00
Denis Ledoux 7ab413724a [MERGE] forward port of branch 7.0 up to da15c9d 2014-11-14 15:59:33 +01:00
Denis Ledoux da15c9d27b [FIX] web: do not set the one2many dirty on field validation
This rev. 06104ba553

Added the dirty flag on the o2m field when the editor of the editable list was enabled (meaning that the editable list has been altered)) because the dirty flag was not set correctly by the one2many during the edition, at the time.

It looks like this is now the case

Besides, as now, we valid all the editable list of the form, wether or not the editable list was altered, we must not set the o2m as dirty anymore.
2014-11-14 15:52:58 +01:00
Denis Ledoux 2da7b11c36 [MERGE] forward port of branch saas-3 up to c8df9fc 2014-11-06 16:30:33 +01:00
Denis Ledoux c8df9fcc7d [MERGE] forward port of branch 7.0 up to ae99a93 2014-11-06 16:30:00 +01:00
Denis Ledoux ae99a93b88 [FIX] web: many2many_binary widget upload
once widget extended with ReinitializeFieldMixin, the event binding with the binary file input and the on_file_change method can be done in initialize_content instead of start

This fix is related to d36c8b5c9b
2014-11-06 16:26:32 +01:00
Denis Ledoux b7c912ec68 [MERGE] forward port of branch saas-3 up to 22f2728 2014-11-06 15:03:43 +01:00
Denis Ledoux 22f2728d22 [MERGE] forward port of branch 7.0 up to d36c8b5 2014-11-06 14:56:45 +01:00
Denis Ledoux d36c8b5c9b [FIX] web: FieldMany2ManyBinaryMultiFiles must extend ReinitializeFieldMixin
The add attachment button should be displayed while being in edit mode, but not in view mode
As the widget depends on the form actual mode, the widget should be re-rendered each time the actual mode changes

This is the point of the ReinitializeFieldMixin class
2014-11-06 14:51:21 +01:00
Denis Ledoux 89716cb4d6 [MERGE] forward port of branch saas-3 up to c666030 2014-11-05 13:40:30 +01:00
Denis Ledoux c666030539 [MERGE] forward port of branch 7.0 up to cd69dee 2014-11-05 13:39:41 +01:00
Denis Ledoux cd69dee3f2 [FIX] web: inhibit on change flag when validating editable list
To valid all editable list line, we iterate on the lines and set the editor form with the line value, using set_value.
The _inhibit_on_change_flag should be set to True to avoid triggering on changes events

opw-617395
2014-11-05 13:38:49 +01:00
Denis Ledoux 7582f91e1b [MERGE] forward port of branch saas-3 up to c11451c 2014-11-05 10:29:51 +01:00
Denis Ledoux c11451c7e8 [MERGE] forward port of branch 7.0 up to 9a37e5a 2014-11-05 10:29:27 +01:00
Denis Ledoux 9a37e5a59a [FIX] web: regard the view_list has valid if not yet loaded
This fix is related to df845940ed

Fixes #3469
2014-11-05 10:28:57 +01:00
Denis Ledoux f7723037d6 [MERGE] forward port of branch saas-3 up to 8c4a7cb 2014-11-04 12:30:01 +01:00
Denis Ledoux 8c4a7cb371 [MERGE] forward port of branch 7.0 up to 5035c76 2014-11-04 12:19:58 +01:00
Denis Ledoux df845940ed [FIX] web: on editable list save, valid all records
opw-617036:
In my current timesheet, if you add a a required field on the timesheet ids lines, and add data in the summary tab, it was possible to validate the timesheet lines while requried fields were missing.
2014-10-31 17:40:56 +01:00
Martin Trigaux 7ec7f1ba40 [FIX] web: avoid incoherent actual_mode after refresh
When accessing an existing record in form mode directly (enter the url or refresh a page), the daterecord has not been initialized yet. This means that the value of actual_mode will be set to 'edit' before loading the current record (method _actualize_mode() called from do_show()).
This was problematic for one2many fields that we loaded in edit mode, showing add/delete icons/buttons in readonly views. (opw 607910)
2014-10-24 15:36:58 +02:00
Denis Ledoux 6feb5f70e9 [MERGE] forward port of branch 7.0 up to 98c6e7c 2014-10-15 09:44:31 +02:00
Denis Ledoux 98c6e7c3d5 [FIX] web: cherry-pick of 893e426865 & 61207f3f4d 2014-10-15 09:43:26 +02:00
Denis Ledoux 893e426865 [FIX] web: even if there is no view, the field has to be rendered
This is related to ÿ07f3f4d9206d4c1a3e484eb89f09d2258977a
2014-10-14 16:59:13 +02:00
Denis Ledoux 61207f3f4d [FIX] web: push render value deferred only if the field is in a form view 2014-10-14 16:28:47 +02:00