Commit Graph
3175 Commits
Author SHA1 Message Date
Odoo Translation Bot e0b1718e4a [I18N] Update translation terms from Transifex 2018-12-02 03:16:02 +01:00
Sébastien Theys 42ded05f4b [FIX] base: fix print pdf with --test-file command 2018-12-18 13:02:06 +00:00
Martin Trigaux fa98749154 [I18N] export 12.0 source terms
Update to reflect the recent code changes

closes odoo/odoo#29636
2018-12-19 08:50:10 +00:00
Nicolas Martinelli c819fc69ee [FIX] fields, test_impex: export Datetime
- Set a TZ on the user different from UTC
- Export a record containing a datetime, e.g. the Order Date of a SO
- Import the file

The Order Date is changed on the record.

The data export is always in UTC, but the data import takes into account
the user TZ, which explains the difference.

There is no good way of solving this in stable. We have 3 choices:
1. Do nothing: the flow export then import the same data is broken, as
   explained above.
2. Export in the user TZ: if the file is imported in a third-party
   software, we break the flow.
3. Import in UTC: if the file is generated from a third-party software,
   we break the flow.

Whatever the choice is, we either break a flow or keep an inconsistent
behavior. We choose option 2, assuming that in most cases the user wants
to export the data in his TZ, therefore keeping the values displayed. We
only do it in v12 in order to mitigate the impact on existing
installations. A proper fix should be discussed for v13.

opw-1915631

closes odoo/odoo#29576
2018-12-18 07:13:34 +00:00
Nicolas Martinelli dc9e87baa6 [FIX] test_impex: use context provided
The `export` method accepts a `context` parameter, but doesn't use it.
This actually hides an incorrect test: when exporting in French, `Bar`
should be exported as `titi`.
2018-12-17 13:37:32 +00:00
Nicolas Martinelli 5f4a945182 [FIX] modules: load demo data fallback
- Create a new DB with `base_automation`, without demo data
- Switch to developer mode
- Go to Settings, then 'Load demo data', validate

A traceback occurs.

An error since the demo data in `base_automation_demo.xml` are pointing
to `model_base_automation_lead_test`, which is a test model. It is
therefore not created whithout demo data. The error is:

```
bad query: b'RELEASE SAVEPOINT "5159....."'
```

However, that's not the real crash. Indeed, in case the installation of
demo data crashes, `demo_failure_todo` is supposed to handle the
situation like a boss. But in this case, the DB cursor seems unusable.
Therefore, the following crashes like a gros caca:

``` python
todo = env.ref('base.demo_failure_todo', raise_if_not_found=False)
```

Solution: use a new cursor.

opw-1916918

closes odoo/odoo#29528
2018-12-13 18:22:34 +00:00
Odoo Translation Bot 3ce5c8bebd [I18N] Update translation terms from Transifex 2018-12-16 01:18:51 +01:00
Raphael Collet a8f4b522a3 [FIX] models: onchange sends all fields upon change in x2many
On a record with a large x2many, the web client does not load all the data of
the lines (because of paging).  If a line is modified by an onchange, at some
point the client will determine whether lines are valid (all required fields
are provided).  It is possible that the client cannot evaluate the validity of
the modified line because of missing fields.  In order to avoid this situaion,
the server sends all fields on modified lines.
2018-11-30 13:34:44 +00:00
Raphael Collet 95f4287b6a [FIX] models: make onchange return a smaller diff
Large diffs (specifically in x2many fields) cause performance issues.  They
overload the web client, which considers all returned fields as dirty.
2018-11-30 13:34:20 +00:00
Christophe Simonis e3323a9b52 [MERGE] forward port branch saas-14 up to ba88252bc0 2018-11-30 12:44:11 +01:00
Christophe Simonis ba88252bc0 [MERGE] forward port branch 10.0 up to 80a11ca27d 2018-11-30 11:58:25 +01:00
Richard Mathot 1d553eea7b [FIX] models.py: log the full traceback when record import fails
Without the full stack trace, it is very hard for the developers to know
why and where the record creation has failed.

closes odoo/odoo#29143
2018-11-29 15:12:59 +00:00
Ravi Gohil 8a18ef0c5a [FIX] base: allow property field to be set to False
closes odoo/odoo#29147
2018-11-29 13:46:54 +00:00
Christophe Simonis efe7ca16b7 [MERGE] forward port branch 11.0 up to bb6f6c57f9 2018-11-28 17:44:46 +01:00
Christophe Simonis bb6f6c57f9 [MERGE] forward port branch saas-15 up to 925210714f 2018-11-28 16:13:24 +01:00
len-odoo 8f3ac2530f [FIX] base, partner_autocomplete: remove vat from the partner selection field
Commit a6e1eb9f0a
introduced the show_vat context key, that displays the Tax ID of a customer
after its name when present, similarly to show_address.

However it appears on the field when being edited, then disappears at save,
which is confusing.
Other unclean things tended to happen: you would have "name - taxid" on customer
field, but "name" on invoice address and delivery address.
Furthermore a client could edit the name manually to erase the Tax ID, and thus
recreate a new record for the same customer.

We introduce a method to clean the name from the Tax ID, and use it so that it
is directly the client's name that is selected at edit.

Note that we also replace the standard dash in the 'name - taxid'
by a figuredash (‒, U+2012) so as to avoid potential egregious splits
because of legitimate customer names.

Similar to commit: 3cbfc40303
(same thing for show_address)

opw 1911954

closes odoo/odoo#29189
2018-12-03 09:23:33 +00:00
Odoo Translation Bot 1208ac6ce3 [I18N] Update translation terms from Transifex 2018-12-02 01:25:05 +01:00
Raphael Collet 6a71a68046 [FIX] models: onchange sends all fields upon change in x2many
On a record with a large x2many, the web client does not load all the data of
the lines (because of paging).  If a line is modified by an onchange, at some
point the client will determine whether lines are valid (all required fields
are provided).  It is possible that the client cannot evaluate the validity of
the modified line because of missing fields.  In order to avoid this situaion,
the server sends all fields on modified lines.

closes odoo/odoo#29177
2018-11-30 09:57:11 +00:00
Christophe Simonis f5c3dafb04 [MERGE] forward port branch saas-11.3 up to c0eef42711 2018-11-29 18:38:55 +01:00
Nicolas Lempereur 8e7c255237 [FIX] *: fix % in translation not on transifex +da
Fix issue of %s or %(name)s present in source but not in translation
in language not available on transifex.com/odoo/

Also correct a account danish (da) translation that was reported to be
an issue.

closes #29100
2018-11-29 12:52:45 +00:00
Olivier Dony 52a970bce3 [FIX] base: make demo install warning more prominent
Users may not notice the warning and carry the risk of irreversibly
damaging their production database. Making the warning message more
frightening should help avoid this.

closes odoo/odoo#29128
2018-11-29 11:13:39 +00:00
Lucas Perais (lpe) c432667fbf [FIX] base,web_editor: get_view_id should return singleton
Because of 9a98a4d60e
and since the key of an ir.ui.view cannot be unique
(multiwebsite), duplicating views made several parts of Odoo crash

After this commit, we limit to one the views that are searched with their key
Responsibility is given to the user to change the priority and/or the key
in order to predict which view will be taken

OPW 1913335,1913100,1913186,1913112,1913240

closes odoo/odoo#29105
2018-11-28 15:26:48 +00:00
Christophe Simonis 925210714f [MERGE] forward port branch saas-14 up to 8ee67f2a19 2018-11-28 15:43:17 +01:00
Christophe Simonis 8ee67f2a19 [MERGE] forward port branch 10.0 up to 42c42832b3 2018-11-28 14:41:28 +01:00
Romain Derie b9b1c08837 [IMP] base: add key in ir.ui.view search view
With multi-website support, the `key` field is more important than ever as it
kind of replace the xml_id behavior.

Thus, on the ir.ui.view list view it is common to search on `key`. Having it in
the search bar is mandatory.

closes odoo/odoo#29417
2018-12-11 10:39:55 +00:00
Yannick Tivisse d7a2148360 [IMP] hr_payroll: Show only localizations on res_config 2018-12-06 13:15:36 +01:00
Christophe Simonis e1f9499d26 [MERGE] forward port branch 12.0 up to 053bb45706 2018-12-05 18:46:15 +01:00
Thibault Delavallée 58997a9557 [REV][IMP] base: Improve search and ordering in settings
This reverts commit 01173f3745.

This commit added improvements in search and ordering of settings. However
due to DOM manipulation some events are not bound correctly. Notably saving
settings could be broken if several different tabs are modified before
saving.

After checking more in-depth settings code it appears it will be difficult
to ensure a proper re-rendering and re-ordering of settings without having
to modify deeply the code. This is therefore more a task for JS framework
team.

closes odoo/odoo#29285
2018-12-05 14:38:41 +00:00
qmo-odoo 01173f3745 [IMP] base: Improve search and ordering in settings
Allows users to not only search on settings name but on their description too.
Improves search results relevance :
Instead of the actual fixed order, top results should be about the module
selected in the left panel

Task : #1893252
closes : #28094
2018-12-04 10:19:08 +00:00
Odoo Translation Bot ebbb5b8d37 [I18N] Update translation terms from Transifex 2019-01-27 03:14:28 +01:00
Denis Ledoux 8fb76c425d [IMP] api: improve storing performance of the api cache
This revision moves the `cache_key` to the first level
dict of the cache, instead of the last one.

Doing so, we reduce the number of times the reference
to the cache key is stored in the dict.

For instance,
for 100.000 records, 20 fields and 2 env (e.g. with and without sudo)
formerly, there were 100.000 * 20 * 2 occurences of cache key references
now, there is only 2 references.

Storing references to an object consumes memory.
Therefore, by reducing the number of object references
in the cache, we reduce the memory consumed by the cache.
Also, we reduce the time to access a value in the cache
as the cache size is smaller.

The time and memory consumption are therefore improved,
while keeping the advantages of revision
d7190a3fd0
which was about sharing the cache of fields
which do not depends on the context, but
only on the cursor and user id.

This revision relies on the fact there are less different references
to the cache key then references to fields/records.
Indeed, this is more likely to have 100.000 different records stored
in the cache rather than 100.000 different environments.

Here is the Python proof of concept that was used
to make the conclusion that setting the cache_key
in the first level dict of the cache is more efficient.
```Python
import os
import psutil
import time

from collections import defaultdict

cr = object()
uid = 1
fields = [object() for i in range(20)]
number_items = 500000

p = psutil.Process(os.getpid())
m = p.memory_info().rss
s = time.time()

cache_key = (cr, uid)
cache = defaultdict(lambda: defaultdict(dict))
for field in fields:
    for i in range(number_items):
        cache[field][i][cache_key] = 5.0
        # cache[cache_key][field][i] = 5.0

print('Memory: %s' % (p.memory_info().rss - m,))
print('Time: %s' % (time.time() - s,))

```
- Using `cache[field][i][cache_key]`:
   - Time: 3.17s
   - Memory: 3138MB
- Using `cache[cache_key][field][i]`:
   - Time: 1.43s
   - Memory: 756MB

Even worse, when the cache key tuple is instantiated inside the loop,
for the former cache structure (e.g. `cache[field][i][(cr, uid)]`),
the time goes from 3.17s to 25.63s and the memory from 3138MB to 3773MB

Here is the same proof of concept, but using the Odoo API and Cache:
```Python
import os
import psutil
import time

from odoo.api import Cache

model = env['res.users']
records = [model.new() for i in range(100000)]

p = psutil.Process(os.getpid())
m = p.memory_info().rss
s = time.time()

cache = Cache()
char_fields = [field for field in model._fields.values() if field.type == 'char']
for field in char_fields:
    for record in records:
        cache.set(record, field, 'test')

print('Memory: %s' % (p.memory_info().rss - m,))
print('Time: %s' % (time.time() - s,))
```
- Before (`cache[field][record_id][cache_key]` and cache_key tuple instantiated in the loop):
   - Time: 4.12s
   - Memory: 810MB
- After (`cache[cache_key][field][record_id]` and cache_key tuple stored in the env and re-used):
   - Time: 1.63s
   - Memory: 125MB

This can be played in an Odoo shell, for instance
by storing it in `/tmp/test.py`, and then
piping it to the Odoo shell:
`cat /tmp/test.py | ./odoo-bin shell -d 12.0`

closes odoo/odoo#29676

closes odoo/odoo#30554
2019-01-25 16:25:27 +00:00
Denis Ledoux 79416ba6c4 [IMP] api: gain some memory by not creating the cache_key tuple multiple times 2019-01-25 16:24:59 +00:00
Raphael Collet f9582bf1db [FIX] base: missing tests on record cache 2019-01-25 16:24:55 +00:00
Christophe Simonis 476866ddab [MERGE] forward port branch saas-14 up to f5dc49da89 2018-11-27 17:09:04 +01:00
Christophe Simonis f5dc49da89 [MERGE] forward port branch 10.0 up to 6639630de1 2018-11-27 17:08:00 +01:00
Raphael Collet 42c42832b3 [FIX] base: translations lost after synchronization
Modifying a source term in an XML/HTML translated field can lose translations
if the same term is translated in several languages.

closes odoo/odoo#29078
2018-11-27 16:07:46 +00:00
Denis Roussel 6639630de1 [FIX] base: make check_credentials more consistent with alternatives
The other methods do test password length before verifying it, so even
if check_credentials() is not meant to be called directly, it's better
to keep it consistent with the alternatives.

Closes #29023
2018-11-27 10:14:43 +01:00
Christophe Simonis b09f624f20 [MERGE] forward port branch 11.0 up to 263b388c50 2018-11-22 17:52:57 +01:00
Christophe Simonis 263b388c50 [MERGE] forward port branch saas-15 up to e44c35f407 2018-11-22 17:06:31 +01:00
Odoo Translation Bot 536cd8caea [I18N] Update translation terms from Transifex 2018-12-01 02:45:01 +01:00
Toufik Benjaa 23a7b15276 [FIX] http: avoid crash on jsonp POST+GET
- This commit fixes a crash that happens when the server receive a
  JSON-P call done in two requests (a POST followed by a GET).

  The issue is due to the fact that when the first request is done (POST
  one) the member `params` is never initialized.

  This parameter is then used in the module `auth_signup` on an override
  of the method `dispatch` thus crashing the code.

  To avoid the crash, we now initialize `params`.

closes odoo/odoo#27369
2018-11-21 10:09:10 +00:00
Lucas Perais (lpe) 07d4505759 [FIX] base: res_partner: clarify string of commercial_partner_country_id
To avoid confusion in the filters and elsewhere

OPW 1910654

closes odoo/odoo#28848
2018-11-20 14:39:14 +00:00
Raphael Collet 4894419b61 [FIX] cache: ormcache logger
The adaptation to Python 3 was done with two mistakes: the iteration on the lru
cache does not return keys, and functions are not sortable.

closes odoo/odoo#28870
2018-11-21 10:16:06 +00:00
lul-odoo f598c3e597 [IMP] base,stock: Improve company demo data
On test fixes: Because the company now have parenthesis in its name,
formatting email addresses adds double quotes around the name.
e.g.: "My Company (San Francisco)" <example@exmaple.com>
2018-12-03 16:12:27 +01:00
Antony Lesuisse 0af56a4364 [IMP] base: default name for ir.actions.act_window
Take the name of the model if no name is set for an action

closes odoo/odoo#29027
2018-11-29 09:06:33 +00:00
Christophe Simonis ce4cc24621 [MERGE] forward port branch 12.0 up to 82a1e1dcc3 2018-11-29 20:06:16 +01:00
Xavier Morel 4d7aa97da3 [FIX] core: fixup of convert cleanup
_tag_delete was not properly converted when the _tag_ calling
convention was modified in 4d581e26c2,
so <delete> tags would all blow up if encountered.

closes odoo/odoo#29149
2018-11-29 13:46:14 +00:00
Adrian Torres 758382b3a7 [REM] pycompat: remove python 2 shims and helpers
Odoo no longer supports python 2, thus some of these helpers can and
have been replaced by python 3 built-ins, therefore there is no need for
them to stay defined.

The removed helpers are:
    * izip, imap and ifilter
    * unichr, text_type
    * implements_to_string, implements_iterator
    * string_types, integer_types
    * to_native

The python 2 shims have also been removed, and only the python 3 helpers
have been kept, because they can still be usable (i.e. accepting
both bytes and str for functions that can only accept one of the two)

[REM] pyjsparser: remove PY3 shims

They're no longer necessary as Odoo doesn't officially support python 2
anymore.

closes odoo/odoo#28519
2018-11-29 09:28:17 +00:00
Adrian Torres 52f5528cfb [REF] *: replace deprecated pycompat helpers for builtins
This commit replaces calls to pycompat helpers that were intended for
python 2 <-> python 3 interoperability for python 3 builtins, as python
2 is no longer officially supported by Odoo.

This includes:
    * calls to imap/izip/ifilter replaced by map/zip/filter
    * uses of text_type replaced by str
    * uses of unichr replaced by chr
    * calls to implements_to_string, implements_iterator removed
    * string_types and integer_types replaced by str, int respectively
    * calls to to_native replaced by calls to to_text

This is done in preparation to the removal of these deprecated helpers
in the following commit.
2018-11-29 09:28:17 +00:00
Adrian Torres e5c864a596 [REM] test_pylint: remove PY2/PY3 restrictions
Since Odoo no longer officially supports python 2, some of the
restrictions previously imposed by test_pylint are no longer necessary,
either because the usage of some builtin functions is legal (zip, map,
filter) or because the concerned function/module would already raise a
relevant error under python 3.
2018-11-29 09:24:26 +00:00