Commit Graph

4697 Commits

Author SHA1 Message Date
Christophe Matthieu 0ba248aeda [FIX] web: prevent default value changes
Load record use values as dataset and change object value (for eg: add virtual id in the default value object).
2015-12-01 13:41:28 +01:00
Nicolas Lempereur 15b0596c31 [IMP] web: remove onchange on m2o one remove record
These onchanges were needless since it was already done by the
BufferedDataSet when we use alter_ids to add/remove ids/virtual ids from
the recordset.

The onchanges this commit remove were introduced with 6b907bb4d in
juliet 2012 whilst the onchange in the BufferedDataSet when using
dataset alter_ids was with dd747c096 in october 2012.

closes #8273
fixes #7595
opw-644706
2015-11-10 12:38:04 +01:00
Nicolas Lempereur 3e1d5a5cca [IMP] web: remove needless o2m onchange
Partial backport of master (-> v9) commit 059230512.

for the issue when removing an invoice line from an account.invoice,
three onchange where triggered:

- ListView account.invoice.line unlink the line id from its dataset,
  [[first onchange]]
  -> the line id is removed from the dataset which trigger an onchange

after this is done (and the onchange is finished), the following
onchange happen:

-- remove each record of the Collection of the ListView
   -> this remove the id of these record from the ListView List dataset
      [[second onchange]]
      -> this trigger an onchange albeit the dataset is not changed
         (since it was already removed before the first onchange)
   -> this trigger an onchange on the one2many_list of the ListView
      which has the same dataset as the ListView
      [[third onchange]]
      -> so an onchange is called yet again.

this commit removes the second onchange in this case where we remove ids
already removed from the dataset.

closes #8273
fixes #7595
opw-644706
2015-11-10 12:36:06 +01:00
Nicolas Martinelli ea2c80cad0 [FIX] web: Python-like rounding method
Javascript and Python handle the rounding of -x.5 differently.

In JS, `Math.round(-0.5)` is equal to `-0`.
In Python, `round(-0.5)` is equal to `-1`.

This will lead to inconsistencies between Python and Javascript, but it
can also lead to inconsistencies in the Javascript itself. Indeed, in
the POS, a refund to the client is entered as a negative number. For
example, `4.245` will be rounded to `4.25`, but a refund of `-4.245`
will be rounded to `-4.24`. The payment and the refund are not
consistent.

Sources:
- http://www.ecma-international.org/ecma-262/6.0/index.html#sec-math.round
- https://docs.python.org/2/library/functions.html#round
- https://en.wikipedia.org/wiki/Rounding#Round_half_up

Fixes #9249
opw-653034
2015-11-04 13:14:59 +01:00
Christophe Matthieu ee2b550f3c [FIX] web: radio button display empty value when change record
When a selection field with widget="radio" is False, the form view display the previews value for this field.

1 - Create a selection field (ex: [("1", "1"), ("2", "2")]), and display it on a form vue.
2 - Go to the form view (all the record have False value for this field).
3 - Change the value of this field for one record.
4 - In readonly mode, all other records now wrongly display this value (still False in DB or when "edit").

#opw-652002
2015-10-29 07:21:36 +01:00
Christophe Matthieu 2f842d1703 [FIX] web: assertion error when save after speed multi delete in one2many
To reproduce use a form view with a one2many editable list and create a lot of lines. Then click a few times quickly on the delete.
If the user click at least two times on delete of a same record, the dataset add the id in "to_delete" the virtual id because "to_create" doesn't contains the virtual id of the record deleted previously.

E.g.: create a "Customer Payments" and select a "Customer" and "Payment Method" who generate a lot of "Credits" lines.
2015-10-12 17:15:28 +02:00
Christophe Simonis d744923b63 [MERGE] forward port of branch saas-3 up to 1783a7d 2015-08-27 18:01:52 +02:00
Christophe Simonis 1783a7d005 [MERGE] forward port of branch 7.0 up to 411a07a 2015-08-27 18:01:14 +02:00
Nicolas Lempereur 411a07a64e [FIX] web: enable default_focus on html field
closes #8244
opw-647578
2015-08-27 13:20:41 +02:00
Nicolas Lempereur e2930e19a0 [FIX] web: glitch with scroll and list editable
On a first edition of a view list editable, scrolling before the first
edition might cause an issue: the editing fields are higher than they
should.

This commit solves this.

This issue stems from jQuery .offset({value}) function which is broken
if the element we want to position:

- is in absolute postionning,
- is inside a scrolled element in non static positionning,
- has not both top and left css property setted,
- has no ancestor element between itself and the scrolled not in static
  positionning.

This issue happens less (and probably not at all) in saas-6 since the
last condition is most often not met thanks to this change:
 https://github.com/odoo/odoo/commit/1ccd87a#diff-27c072074221456684bfc5f150ca0bc9R876

This issue of jquery is solved since jquery 3.0.0-alpha1:
 https://github.com/jquery/jquery/commit/2d71594

( the issue is shown in https://jsfiddle.net/wpjrnggf/ and we can see it
is solved with jQuery 3.0.0-alpha1 https://jsfiddle.net/L6ykpjgy/ )

closes #8251
opw-647622
2015-08-27 13:17:00 +02:00
Holger Brunn f204c76f23 [FIX] web: keep the context we got in Many2ManyDataset
This bug causes binary fields in many2many lists being presented as a data url,
even though bin_size is passed.

Closes #6966
2015-07-08 13:42:59 +02:00
Nicolas Martinelli b4efb4eeb3 [FIX] web: on calendar with date and time, focus in the field only when hidden
The behavior of the datetime widget was to focus in the field every time a date
is chosen. This causes an issue if the datetime widget is called from an
editable list. Indeed, the list editable will consider that the value has been
set, and therefore the value will not be changed anymore if the user choses
another date.

The new behavior is to put the focus only when the date picker is hidden,
therefore the editable list will consider the value set only when the selection
is done.

opw-644062
Fixes #7463
2015-07-07 11:19:27 +02:00
Nicolas Lempereur b5d7e663b4 [FIX] web: readonly field and tab
When we go from one field to another via the tab key, in the form view what happens is:

{{we get a blur from the current field}}
-> if [[widget was not in state clicked (which can be gotten for example by clicking on a focused field)]]
     -> blur event is cancelled,
     -> the blur event is set to be triggered soon
-> the clicked state is set to false

{{we may get a focus for the next field}}
-> if [next field get an onfocus event]
     -> blur event is cancelled,

So if :
- the state is not clicked and,
- the next field don't get an focus event.

We get a blur event which will either save (if a field value has been changed) or cancel
the form view editing and will hide the current edition, hence losing the focus.

For example, it happens on a readonly fields with  field containing an `<a />` tag, on
some browser (for example google chrome), the focus event will not get triggered (it still
work if we were in a clicked state) so we can't cycle thought a list editable cells if there is a readonly field in it.

closes #7446
opw-643718
2015-07-06 11:55:01 +02:00
Stefan Rijnhart 33a65c2b8e [FIX] web: binary fields in one2many widgets
Don't retrieve the binary contents just to display the size, but pass context
with bin_size=True instead
Always pass filename in download link

Combination of patches from the bug report from Enrico Ganzaroli, Cedric Le
Brouster and Holger Brunn
Fixes #4899, lp:1167429
2015-06-25 11:45:47 +02:00
Christophe Simonis b8bf1e0905 [MERGE] forward port of branch saas-3 up to ea659cb 2015-06-24 12:37:08 +02:00
Christophe Simonis ea659cbd87 [MERGE] forward port of branch 7.0 up to 16a545b 2015-06-24 12:34:03 +02:00
Nicolas Lempereur 1942522969 [FIX] base: update File Content for binary field
To distinguish two ir.attachment 'File Content', we base it on the file
size (this I imagine is for efficiency).

This is done by setting bin_size in the context. Doing this, the
returned db_datas field will be the file size of the converted to base64
content (if no filestore).

But this size is returned in string format, so "get_nice_size" (in
openerp/osv/fields.py) which gets this size calculates the length of the
string. e.g: if the size is '2142' get_nice_size will return 4.

This fix solves this by converting the string to an integer, thus
unifying it with the filestore case (where we use os.path.getsize which
return an integer).

Also, the field presenting the issue (FieldBinaryFile) has been changed
so it is always updated even if the size is the same (as it was already
done by 3632949 for FieldBinaryImage widget).

closes #7223
opw-643071
2015-06-23 15:20:33 +02:00
Nicolas Martinelli ac4849f9ca [ADD] web: prevent the propagation of context keys containing prefix show_
This decision comes from the following bug:
- Go to Sales -> Quotations, and open any existing quotation in form view (the
  partner must have an address defined)
- Click on the partner
- Click on the stat button "Claims"
- You notice that the address of the partner is included in the search

This is due to the context property show_address which is set to 1 when a
quotation is open. Therefore, it is necessary to filter out this keyword.

Since the prefix "show_" is used for only few context variables, it was decided
to define this pattern as a standard pattern to filter out.

opw-642893
2015-06-22 14:06:11 +02:00
Frédéric van der Essen 19eda68547 [IMP] web, point_of_sale: basic implementation of the cordova integration.
This time without a new js file
2015-05-29 15:33:13 +02:00
Frédéric van der Essen da378722cc Revert "[IMP] web, point_of_sale: basic implementation of the cordova integration."
This reverts commit f7a1ac8b06.
The commit introduced a change that required a database update,
which should not be required in a stable version.
2015-05-27 13:46:26 +02:00
Frédéric van der Essen f7a1ac8b06 [IMP] web, point_of_sale: basic implementation of the cordova integration. 2015-05-27 11:59:13 +02:00
Denis Ledoux ac92551406 [FIX] ir_attachment: hide Attachments > Add/Delete if not write access
To be able to see record attachments, you need to have
read access to the record.

To be able to add or delete attachment, you need to
have write access to the record.

The button add/delete were displayed as soon
as you had the read access, but if you had not the
write access, both buttons failed.

This revision do not display the add/delete
buttons of Attachment dropdown menu if you do not
have the right to add / delete attachments to the record
(you do not have write access to the record)

opw-640242
2015-05-20 11:08:19 +02:00
Denis Ledoux a939a272ef [MERGE] forward port of branch saas-3 up to ae634e7 2015-05-05 17:55:25 +02:00
Denis Ledoux ae634e7a04 [MERGE] forward port of branch 7.0 up to 567ade5 2015-05-05 17:51:31 +02:00
Julien Legros 8e6f9be08f [CHG] web: odoo.com account fallback url
The default odoo.com account page is now located at
https://accounts.odoo.com/account.
2015-05-05 11:29:15 +02:00
Denis Ledoux 41f4b11ef4 [MERGE] forward port of branch saas-3 up to e552e09 2015-04-30 15:45:03 +02:00
Denis Ledoux e552e09873 [MERGE] forward port of branch 7.0 up to e601a41 2015-04-30 14:38:17 +02:00
Denis Ledoux 1da5d89ba3 [FIX] web: advanced search on floats with ',' as decimal separator
When using another decimal separator than `.` (dot)
in the language settings,
it wasn't possible to build an advanced search specifying
the decimals.

e.g. with a language with decimal separator `,` and thousand
separator `.`,
if you want to search invoices with amount total 366,38
The advanced search "Total" "is equal to" obliged you
to enter your number with `.` as separator (366.38),
and then, when entering the search, the `.` was
regarded as the thousand separator, giving as domain
`('amount_total', '=', 36638)`, which is not what you asked.

opw-634201

PS: The `|| '.'` in the xml template are only for
retro-compatibility, so if the server sources are
updated, but the browser cache is not refreshed
(meaning the Javascript code isn't refreshed, and,
therefore, `widget.decimal_point is undefined)
it still works.
2015-04-30 13:39:30 +02:00
Christophe Matthieu e9c3336003 [IMP] website: improved tours error message and race conditions 2015-04-29 10:25:20 +02:00
Nicolas Lempereur 71aa34fb54 [FIX] web: see selection didn't show selection
This fix gives the domain to the "See selection" view opened from a
FieldCharDomain.

In Odoo 8.0, this widget is available at two places:

- mass_mailing: Marketing > Mass Mailing | Mass Mailing > (any
  newsletter) > "See selection".

- gamification: Settings > Gamification Tools > Challenge > (any
  challenge) > "See selection".

With this fix the "Selected records" view display selected records.

closes #6463
opw-633201
2015-04-28 09:22:07 +02:00
Nicolas Lempereur a1bfa84f65 [FIX] web: get right result for arrow suggestions
In the search input, the result of filtered search with an arrow was
placed under the currently selected arrow.

Hence if we get to another arrow filter before the result is received,
the result is added under the wrong arrow.

This fix adds the result under the right arrow.

closes #6442
opw-632519
2015-04-24 11:32:58 +02:00
andreparames d4aa2decde [FIX] web: onchange compare changes using === operator
The onchange handler is doing a weak comparison between the values received from
the onchange() method and the current field value, which leads to a falsy value
such as "0000" being treated as equal to False.
This patches changes the operator to enforce non-coercive equality.
Fixes #6405
2015-04-23 16:02:21 +02:00
Nicolas Lempereur 76881fb226 [FIX] web: backport datetime.toJSON() so we can return local datetimes in search domains
This fix adds the toJSON() method to datetime.datetime,
so domain expressions can use datetime values directly,
without having to compute the stringified version
with convoluted strftime() and timezone calculations.

The datetime results are sent down to the JSON-RPC
level where the JSON.stringify() serialization will
convert them to UTC string, to be deserialized
properly as UTC datetime values on the server side.

Thanks to this we can use the browser's local midnight
timestamp in a filter expression, for example like this:

`datetime.datetime.combine(context_today(), datetime.time(0,0,0))`

and get the expected result regardless of the user/browser's
timezone.

related to issue #2972 and pull request #2914 and #6229

(Next commit will fix them)

opw-621282
2015-04-23 14:05:56 +02:00
Denis Ledoux 84e10ad03b [FIX] web: translation of default M2O values in search bar
When a many2one field of a searchview was selected
by default, through a default_*_id within the context,
the many2one value name wasn't translated.

e.g. with Spanish loaded (and l10n_multilang installed),
translate a project.project name in Spanish.
Then, while being in Spanish, in the project.project kanban,
click on the Tasks link of a project (tareas),
then, notice the value of the project name in the
search bar.

opw-632818
2015-04-22 17:53:35 +02:00
Nicolas Lempereur 2b90e054bb [FIX] web: keep domain with search field
Currently (since commit e6a2d222d6), the domain of a search view field tag
is dropped.

This previous change was done since some of these domains refers to a
field not available in the javascript.

This fix drop the domain only if it can't be evaluated in the javascript
side.

opw-632030
2015-04-22 10:58:19 +02:00
Luc De Meyer f8a2a64ade [FIX] web: onchange on field binary
If a onchange is set on a binary field, the name of the file (filename attribute
defined in the view) is still the name of the previous file.
Fixes #2427, opw 617109
2015-04-20 16:42:15 +02:00
Martin Trigaux 6262e3479b [FIX] web: onchange on field binary
When setting a value to a field binary, a char field can be set as 'filename'
that needs to be recomputed to specify the new file name.
Before new api, the _internal_set_value method would trigger a onchange but it's
no longer the case now (so onchange on filename field was no longer executed).
Instead, manually set the value using set_value method which do trigger the
onchange.
Fixes #2427, opw 617109
2015-04-20 16:33:55 +02:00
Christophe Simonis 2492503dcc [MERGE] forward port of branch saas-3 up to 50665b4 2015-04-16 19:25:53 +02:00
Christophe Simonis 50665b499a [MERGE] forward port of branch 7.0 up to d0ef1b9 2015-04-16 19:13:56 +02:00
dhr-odoo d0ef1b938d [FIX] Fixed wrong digits format issue for float fields when thousand separator is '.'
The function was returning the number value directly before proceeding to any formatting.
2015-04-16 15:30:20 +02:00
Denis Ledoux 8121f29848 [FIX] web: float seen as changed with digits set to 0
Do not check float_is_zero for float fields with
digits specifically set to 0, it means
the rounding precision is infintie for those ones,
and tmp === val is enough.
2015-04-03 16:37:28 +02:00
Christophe Simonis 8ad11055bb [MERGE] forward port of branch saas-3 up to 12f600c 2015-04-01 19:13:25 +02:00
Christophe Simonis 12f600cec9 [MERGE] forward port of branch 7.0 up to 35077af 2015-04-01 19:07:59 +02:00
Cedric Snauwaert 80d3adc1f3 [FIX] web: when converting a node back to xml, correctly escape node content 2015-04-01 11:02:31 +02:00
Christophe Simonis d780014248 [MERGE] forward port of branch saas-3 up to ce69064 2015-03-26 18:00:06 +01:00
Christophe Simonis ce690649e9 [MERGE] forward port of branch 7.0 up to 2a0c018 2015-03-26 17:56:05 +01:00
Nicolas Lempereur aaf9badbce [FIX] account: context/domain in move line tree
On a line write in a account.move.line tree view, the on_write return all the
sibling move lines of the written move line. The lines are then displayed even
if they do not match the current search domain.

This fix adds the context on the given on_write callback request, and in
on_create_write use a on_write_domain in this context to filter the returned ids.

fixes #3161, closes #5727

opw-630093
2015-03-26 08:59:23 +01:00
Christophe Simonis 3540ec53e4 [MERGE] forward port of branch saas-3 up to 6b70b80 2015-03-25 18:00:08 +01:00
Christophe Simonis 6b70b80a0e [MERGE] forward port of branch 7.0 up to 881c10b 2015-03-25 17:41:53 +01:00
Christophe Simonis 77a75d4e1f [FIX] web: remove leftover `future_display_name`.
see 694fe1f
2015-03-21 15:59:05 +01:00