Commit Graph

8015 Commits

Author SHA1 Message Date
Christophe Simonis 88e8107e01 [MERGE] forward port of branch saas-3 up to 505e308 2015-07-14 15:13:03 +02:00
Christophe Simonis 505e308cd6 [MERGE] forward port of branch 7.0 up to e12cece 2015-07-14 15:00:33 +02:00
Olivier LAURENT e12cecea9d [FIX] tools: separator in po comments
Comments in .po(t) files for translations of type "code" (e.g. field labels)
specify the path to the file containing the translation. This path should be
OS-independent to get the same result whatever the plateform the instance is
running on.
Closes #7561
2015-07-14 11:40:16 +02:00
Jonathan Nemry (ACSONE) 1bc2608490 [FIX] base: add missing context
Propagates context when calling method 'attributes' of ir_qweb
Closes #7582
2015-07-14 11:08:20 +02:00
Daniel Reis e20cf77ce0 [FIX] cli: Backport client command discovery optimization
Lazy load modules to avoid import of unmet dependencies such as ldap.
2015-07-12 16:40:55 +02:00
Odoo Translation Bot 99a7d530e0 [I18N] Update translation terms from Transifex 2015-07-12 01:51:44 +02:00
Christophe Simonis 9654b54d3c [MERGE] forward port of branch saas-3 up to b15461b 2015-07-10 16:46:40 +02:00
Christophe Simonis b15461baba [MERGE] forward port of branch 7.0 up to 1d01872 2015-07-10 16:30:48 +02:00
Christophe Simonis 6e73a31146 [FIX] base: ir.qweb: fault tolerant save of assets.
Do not fail if an asset cannot be cached into the database.
2015-07-10 16:10:59 +02:00
Dariusz Żbikowski 0f4399bb7b [FIX] res.country: address format in polan
Address format in Poland looks like:

Legionów 93
91-072 Lodz
Poland

see: http://en.wikipedia.org/wiki/Address_%28geography%29#Poland

Closes #2416
2015-07-10 11:37:34 +02:00
David Beal d780f9476d [FIX] res.currency: allow duplication
Currencies must be unique per company.
Therefore, without this revision, adding `(Copy)`
to the currency name on duplication, this
is simply not possible to duplicate a currency.

Closes #2443
2015-07-09 17:15:30 +02:00
Nicolas Martinelli f3e4d0a2e8 [FIX] openerp: export None instead of False in raw_data mode
If we export False or an empty string, the Excel export will consider the field
similarly to a boolean, and en empty value will be converted into "=False()" in
Excel. To prevent this, we return "None" in the following cases:

- String
- Date
- Datetime
- Selection
- Reference
- Many2one
- RelationalMulti

Introduced by 6243d18

opw-643966
2015-07-09 11:49:04 +02:00
andreparames 067fd2f342 [FIX] models: don't assume ids are ints in sorted()
Some models (e.g. calendar.event), use "virtual" ids which are not represented
as integers. It was not possible to use sorted method on those models as calling
int() is failing.

This commit fixes the method, making it agnostic to the type of the
'id' member variable.

Fixes #7454
2015-07-08 15:00:32 +02:00
Temur Vibliani 0eeab361d9 [FIX] tools: Added Georgian Language to the installable languages 2015-07-08 11:51:35 +02:00
Denis Ledoux f86d5870fc [FIX] res.country: Preferred address format
According to the USPS, separating the city name
and the zip code with a comma is acceptable,
but the preferred format omits the comma.

http://pe.usps.gov/cpim/ftp/pubs/Pub28/pub28.pdf

opw-644000
2015-07-08 11:13:46 +02:00
Nicolas Lempereur e33baecfa3 [FIX] osv: binary size already in human format
In version 8.0, postgresql's pg_size_pretty function is used
(http://www.postgresql.org/docs/9.4/static/functions-admin.html) when
getting the size of a binary field when reading if `bin_size`
or `bin_size_[col_name]` is set in the context.

So in 8.0 the size of a binary field get units bytes, kB, MB, GB and TB
which was not taken into account. e.g: '5.3 GB'.

This fix uses the size of the string to choose to differenciate the two.

e.g: '10000 bytes' (the longest size) will be returned directly, but
for something longer the human size of the content length will be
returned.

There is a corner case if a file is shorter than 12 bytes but
it is an enough of a small scenario with small implications that it is
deemed acceptable.

closes #7485
opw-644085
2015-07-07 19:17:43 +02:00
Christophe Simonis 00afd776fd [MERGE] forward port of branch saas-3 up to dbe60c7 2015-07-07 15:42:58 +02:00
Christophe Simonis dbe60c7bce [MERGE] forward port of branch 7.0 up to 3add4f6 2015-07-07 15:40:31 +02:00
Martin Trigaux 3add4f665c [FIX] tools: accept multilines on_change
Allow to write on_change on several lines (accepted by view parser but was not
by yaml parser, making false positive at 595216b)
2015-07-07 15:36:15 +02:00
Christophe Simonis acc7d20ea9 [MERGE] forward port of branch saas-3 up to ac865c8 2015-07-07 15:12:41 +02:00
Christophe Simonis ac865c8a78 [MERGE] forward port of branch 7.0 up to 9fa7624 2015-07-07 13:58:35 +02:00
Nicolas Lempereur 0920c2fae0 [FIX] web: sort tree view by id
Previously, if the ID column was displayed it was not sortable.

The particular case added 247c1972 is no longer needed with the new api,
id is in the list of existing fields (see xmo comment in #7461).

closes #7487, closes #7461
fixes #7459
opw-644009
2015-07-07 12:32:38 +02:00
Xavier Morel 95e56a109d [ADD] doc: new theme
Pretty much completely rewritten theme with custom HTML translator and a
few parts of the old theme extracted to their own extensions.

Banner images thought not to be that huge after all, and not worth the
hassle of them living in a different repository.

co-authored with @stefanorigano
2015-07-07 11:22:50 +02:00
Samus CTO 6490c62e5d [FIX] mail: backport of rev 752a07c to 8.0
[FIX] res.partner.find_or_create() should match using =like

Otherwise john@connor.com may match sarah.john@connor.com
2015-07-07 08:52:44 +02:00
Leonardo Donelli 207cf92a0c [DOC] openerp: add missing parameter for search method
The `search` method of models has an additional keyword parameter, `count`.

It not being specified in the docs could lead people to inherit `search`
without defining it, which would result in a `TypeError` when called with
`count=`.

Closes #7451
2015-07-06 14:26:46 +02:00
Odoo Translation Bot fe3835faff [I18N] Update translation terms from Transifex 2015-07-05 01:52:32 +02:00
Frédéric van der Essen fdb9aa29bf [FIX] base: verifying python external dependencies was failing on OSX. 2015-07-03 13:55:52 +02:00
Jeremy Kersten f07be4b675 [REF] base, wesbite_crm: remove placeholder for phone
Some people visiting website doesn't understand that it's a
placeholder and call to Odoo because they see the number on the website.
2015-07-02 15:53:36 +02:00
Matthieu Dietrich f2c807d99d [IMP] account_report_company: performance on partner name_search
The field display_name is present in account_report_company but not in base
on the res.partner (has been added in v8 in base).
Create a hook method to keep using the slow CASE in base and switch to the
faster display_name when installing account_report_company.
2015-07-02 14:10:23 +02:00
Denis Ledoux 49cc4b9d4e [FIX] base: typoe, referencable -> referenceable 2015-07-02 12:59:36 +02:00
andreparames dae0d407c0 [ADD] base: LGPL as possible module license
Keeping in mind than the AGPLv3 core still propagates the license to other
modules.
Fixes #6914
2015-07-02 11:50:40 +02:00
Antonio Espinosa c65fe46569 [FIX] base: runtime error in address_get if ids is empty
Closes #7359
2015-07-02 11:23:34 +02:00
Martin Trigaux 2758aaa6f8 [IMP] models: sanitize error messages in import
Revert 83282f2d for a cleaner sanitizing earlier in the generation of the error
message.

If the import is failing, the error message contains the value that is
problematic. Escape this value in case it contains '%'
2015-07-01 17:04:48 +02:00
Raphael Collet 0939738479 [IMP] fields: speedup of `convert_to_cache` for x2many fields
The algorithm's complexity changed from O(n²) to O(n).
2015-07-01 13:49:14 +02:00
Odoo Translation Bot 2326bb7a54 [I18N] Update translation terms from Transifex 2015-07-01 10:45:16 +02:00
Nicolas Lempereur 45faa3a941 [FIX] base: fixing fix, attachment file size and None
In commit 44f2c8d54 we unified the return value of the function to int,
but it seems the returned size could be None which is not a valid input
of the int() built-in function.
2015-07-01 10:12:24 +02:00
Daniel Reis 8880edd4fb [FIX] cli: start command path option does not work
Using the `start` CLI command with the `--path` or `-p` option arrors with:

    odoo.py: error: no such option: --path

This is because the `--path` option is passed on the server start routine,
and it's invalid there.
A workaround is to remove those command options from the arguments passed
to the main() server start.

Closes #5896
2015-06-30 13:57:14 +02:00
Christophe Simonis 066e41b63d [MERGE] forward port of branch saas-3 up to 31f2a1b 2015-06-30 13:33:35 +02:00
Christophe Simonis 31f2a1bc38 [MERGE] forward port of branch 7.0 up to 1c0bc7c 2015-06-30 12:47:27 +02:00
Mohammad Alhashash 83282f2dea [FIX] models: Escape `%` characters from error messages of a failed import
To prevent susbtituion exception when creating use error message
e.g. No matching record found for external id 'fo%o' in field 'Bar'
Fixes #5933
2015-06-29 16:50:33 +02:00
Martin Trigaux 1c0bc7cc16 [FIX] server: backport of 3940a096 on psutil
psutil 3.0 removed get_momory_info method
create wrapper method for backward compatibility
2015-06-29 16:09:42 +02:00
Odoo Translation Bot acc1b525fa [I18N] Update translation terms from Transifex 2015-06-29 08:42:08 +02:00
Xavier Morel f5b88f6309 [IMP] minor perf improvement during tests
During tests, some creation of user records would unnecessarily trigger
password reset or set a password, both of which would trigger password
hashing which takes some time (for good reasons).

Fix by:
* passing no_reset_password in YAML tests and some Python tests still
  missing it (a number of Python tests already used it)
* removing passwords from YAML records as they're never necessary, the
  test user records are not expected to ever log in
2015-06-26 14:22:29 +02:00
Developer Team bf0630e427 [FIX] tools: add support for transparency of PNG images
Fixes #2569
Closes #6260
2015-06-25 18:51:03 +02:00
Xavier Morel d1a19bcb7f [IMP] base: performances of view._check_xml
View validation accounts for a fair cost of module installation, most of
that is spent checking for view validity, and a significant fraction
of *that* is spent reading the validated view from the DB.

Turns out _check_xml requested *all* view fields even though it needed
none of them save for the arch. Specifying fields to read_combined
rather than fetching all fields seems to result in a ~30% speedup of
_check_xml (under line_profiler). Most of the rest is spent fetching
sub-views (in get_inheriting_view_arch), I don't know that it can be
improved without hand-crafting a fairly complex SQL request.
2015-06-25 10:39:55 +02:00
Miku Laitinen f5dd09dd84 [ADD] base: Finnish address format 2015-06-25 08:47:05 +02:00
Laetitia Gangloff 1511e788cf [FIX] fields: error if there is no value when convert a many2many relation
Closes #1165
2015-06-24 16:52:05 +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
Xavier Morel 11ba4689b1 [IMP] running speed of some tests & new testcase type
Some tests (e.g. mail) have expensive and significant DB setup for a
number of small and cheap tests. Using a TransactionCase, the DB setup
far dominates the tests themselves, by up to 10x (mail unit tests take
~130s on my machine, the tests themselves take ~15s).

The SavepointCase introduced here is an hybrid of SingleTransactionCase
and TransactionCase: it uses a single transaction for all tests in a
class, but each test case is isolated by a rollbacked savepoint. This
allows a common DB setup (via setUpClass) while keeping independent
tests.

TransactionCase should remain the primary test case superclass, but
SavepointCase can be a fair optimisation when setup costs far dominate.
2015-06-23 16:38:14 +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
Olivier Dony 9b1aa53f29 [MERGE] Forward-port saas-3 up to 9cdfb0696a 2015-06-23 15:18:00 +02:00
Olivier Dony 9cdfb0696a [MERGE] Forward-port 7.0 up to 6acd5ef91c 2015-06-23 15:13:47 +02:00
Olivier Dony 6acd5ef91c [FIX] expression: internal domain operators require different parsing
Ensure the absence of internal domain operators is correctly
propagated throughout the domain parsing.
2015-06-23 15:04:45 +02:00
Odoo Translation Bot 35b2463324 [I18N] Update translation terms from Transifex 2015-06-22 13:21:18 +02:00
Christophe Simonis ed3065e3c6 [MERGE] forward port of branch saas-3 up to b7f9f4a 2015-06-18 19:33:19 +02:00
Christophe Simonis b7f9f4ade0 [MERGE] forward port of branch 7.0 up to e8e3f75 2015-06-18 19:29:47 +02:00
Olivier Dony e8e3f75727 [FIX] workers: process signals during graceful shutdown to allow force shutdown
Required after e17844c946 which
enabled graceful shutdown of workers, including the cron worker.
The latter may typically be busy on long-running tasks that
will not be aborted by a simple graceful shutdown request.

A typical shutdown sequence initiated by a daemon manager such
as start-stop-daemon will involve multiple SIGTERM signals to
ensure the process really stops in a timely manner.
This was not possible after e17844c946
if any cron worker was busy.
2015-06-18 19:18:03 +02:00
Martin Trigaux 6bb3be5ba3 [FIX] doc: api.multi/one confusion
As the methods are using @api.multi, it should be accessed with rec, not self
2015-06-17 09:41:09 +02:00
StefanRijnhart 3940a096b2 [FIX] http: Compatibility with psutil 3.0
Version 3.0 has replaced get_memory_info by memory_info.
Create wrapper to be able to use the correct one depending on the installed
version.
2015-06-16 08:59:44 +02:00
Christophe Simonis 885565968f [MERGE] forward port of branch 7.0 up to d566558 2015-06-15 16:24:11 +02:00
Damián Soriano f7742add26 [FIX] tests: restore openerp.tests.common.DB for backwards compatibility
It was removed at 2df9060d97 and broke
tests in community modules that relied on it.

Tests using it should switch to the new get_db_name() method.

Closes #7054
2015-06-15 00:52:20 +02:00
Laurent Mignon (ACSONE) e17844c946 [FIX] server: graceful shutdown must send SIGINT instead of SIGTERM to workers
Workers do not specifically handle SIGTERM so it can be used to
force quit them, but the graceful shutdown is triggered by SIGINT.

Closes #6998
2015-06-12 16:11:59 +02:00
Nicolas Lempereur 3269ad8f48 [FIX] fields: throw truthy values on old api field
In 7.0, a field overriding an inherited model would overwrite all the
previously set field attributes. In v8 the new API allow us to keep
previous attribute, and only overwrite attributes of our wish.

Following the commit 7b1ef708 (october 2014) an old api field overriding
could conserve previous attributes values in some cases (if the new value
is falsy (None, "", 0, False, (), {}, [], ...) when it should not. It
was partly an optimization to diminish the size of orm registries
dictionaries to save memory (this patch has been tested with all odoo
modules and added +/- 3M).

This commit (proposed by rco) should overwrite falsy value (so the
behavior of v7 for old api fields overwritting is re-introduced) and
get back the behavior of old api in V7.

closes #7035
opw-639712
2015-06-12 15:08:54 +02:00
Damián Soriano 2df9060d97 [FIX] tests: db name moved from constant to function
Avoids initializing the DB constant too early
when subcommand modules are loaded, making them
unable to run db-backed tests later.

Closes #6984
2015-06-12 12:43:01 +02:00
Christophe Simonis 5e7f143c21 [MERGE] forward port of branch saas-3 up to ed76b2a 2015-06-11 13:00:49 +02:00
Christophe Simonis ed76b2a782 [MERGE] forward port of branch 7.0 up to e470385 2015-06-11 12:46:06 +02:00
Stéphane Bidoul d291aba4b5 [FIX] server: graceful shutdown must send SIGINT instead of SIGTERM to workers
Workers do not specifically handle SIGTERM so it can be used to
force quit them, but the graceful shutdown is triggered by SIGINT.

Closes #6738
2015-06-11 12:00:57 +02:00
Raphael Collet 4a5e2fe99e Merge pull request #5618 from acsone/8.0-fix-5616-ir_model_fields-from-fields
[FIX] model: use self._fields instead of self._columns to populate ir.model.fields
2015-06-09 09:51:49 +02:00
Odoo Translation Bot e2c9699cfc [I18N] Update translation terms from Transifex 2015-06-08 14:03:50 +02:00
Alexis de Lattre 96135fa785 [FIX] http: correct authentication via JSON-RPC.
Since 31d817e, we rotate then session at login/logout.
Unfortunatly, `openerpframework.js` does not support session id change
at authentication and keep old one.

In order to keep compatibility with existing js clients (including 7.0
ones), we do not rotate the session at authentication.

Fixes #6948
Closes #6949
2015-06-05 12:38:39 +02:00
SauliusZ 2948ed954b [FIX[ base: Currencies changed for Latvia and Lithuania
Latvia changed its currency to Euro from 2014 and Lithuania from 2015. It is not
possible to buy in old currencies anymore.
2015-06-03 19:03:45 +02:00
Jeremy Kersten daa69fb838 [FIX] http: avoid that request.not_found crash
return request.not_found crash with a internal error, because get_response
takes a environment as param.

Werkzeug Documentation:
Keep in mind that you have to pass an environment to get_response() because
some errors fetch additional information from the WSGI environment.
2015-06-01 10:30:16 +02:00
Martin Trigaux 7def86fcc7 [I18N] spring cleaning of untranslated languages
Remove languages that were not translated fro, the list of installable languages.
Installing languages with no translations (en_CA) has no effect and having a too
long list is misleading. Sorry Klingon.

Adding languages that were translated but not installable (fr_CA, en_AU)
2015-05-29 23:40:40 +02:00
Martin Trigaux 4528ccf148 [I18N] First sync of translations from Transifex
Translation is that which transforms everything so that nothing changes.
 -- Grass Günter
2015-05-29 21:58:20 +02:00
Martin Trigaux 409ca3e009 [I18N] Update translations from Transifex
Now I am become Death, the destroyer of worlds
2015-05-29 18:28:10 +02:00
Olivier Dony b17c7d66c7 [I18N] Final sync + cleanup of Launchpad Translations, moving to Transifex
See https://github.com/odoo/odoo/wiki/Translations
2015-05-29 11:22:32 +02:00
Olivier Dony 1cea0dc4e9 [I18N] Final sync + cleanup of Launchpad Translations, moving to Transifex
See https://github.com/odoo/odoo/wiki/Translations
2015-05-29 10:55:06 +02:00
Olivier Dony 3c3581e19f [I18N] Sync latest translations from Launchpad (not the final one) 2015-05-21 18:01:57 +02:00
Christophe Simonis e20dcda50d [MERGE] forward port of branch 7.0 up to 99c87b6 2015-05-21 16:33:45 +02:00
Olivier Dony 53980b7c52 [FIX] account, mail, etc.: uniformize evaluated expressions
opw-626694
2015-05-21 16:07:21 +02:00
Olivier Dony 8d745f9f50 [FIX] account, mail, etc.: uniformize evaluated expressions
opw-626694
2015-05-21 15:26:35 +02:00
Olivier Dony ebb5ddcd65 [I18N] Sync latest translations from Launchpad (not the final one) 2015-05-21 14:42:20 +02:00
Christophe Simonis 327e471c9b [MERGE] forward port of branch saas-3 up to b62ee07 2015-05-21 14:19:24 +02:00
Christophe Simonis b62ee0734c [MERGE] forward port of branch 7.0 up to eaaca65 2015-05-21 14:11:39 +02:00
Christophe Simonis 8a430c4a23 [FIX] base: ir.http: only server_attachement for 404 errors
fixes #6792
2015-05-21 13:46:38 +02:00
Christophe Simonis 1cf5723835 Revert "Revert "[FIX] fields: `digits()` computation""
Thamks to parent commit, `request.env` doesn't raise `AttributeError`
anymore for requests without session bound to a database.

This exception was bubbling up to `digits` property (and `__getattr__`)

This reverts commit 49cb46fb78.
This reinstate commit eeedd2d9f5.
2015-05-21 13:13:23 +02:00
Christophe Simonis 291119c802 [FIX] http: `request.env` and request.cr` now raise `RuntimeError`.
These method used to raise an `AttributeError` when `self.registry`
returns `None`. Now raises a more appropriated exception.
2015-05-21 13:13:23 +02:00
Colin Newell 6e54c8d17a [FIX] web: avoid marking session as modified every time
The `rotate` flag introduced by 31d817e849
was initialized at the very end of the session init, after
the reset of the `modified` flag.
This had the side-effect of marking the session as modified
for every request, saving the session to disk every time
even without any change.

Closes #6795
2015-05-21 12:52:54 +02:00
Denis Ledoux 49cb46fb78 Revert "[FIX] fields: `digits()` computation"
This reverts commit eeedd2d9f5.

This revision introduces an issue more serious than the ones
it fixes. This is no longer possible to receive an email
aimed a sale.order thread with catchall.

To reproduce the issue:
 - Create a new sale order
 - Send a message in the thread to the customer
 - Reply to the mail received in the customer mailbox
 - Traceback, AttributeError: digits

 opw-640370
2015-05-20 19:13:04 +02:00
Denis Ledoux 54a90179bb [FIX] expression: ensure tuple to compare leaf with TRUE/FALSE leaf
When setting a custom filter with as domain
[(0, '=', 1)]

the domain was rejected, because (0, '=', 1) wasn't
considered as a valid leaf, while it is.

This is because the Javascript converts this domain
using list instead of tuple
[(0, '=', 1)] -> [[0, '=', 1]]

And therefore, comparing the "list" leaf
to the TRUE/FALSE leaf tuple failed.

Ensuring "element" as a tuple solves the issue.

opw-640306
2015-05-20 15:33:35 +02:00
Christophe Simonis eeedd2d9f5 [FIX] fields: `digits()` computation
Ensure we always have an valid cursor when determining `digits()`.

fixes #6605, fixes #6650
2015-05-19 19:59:10 +02:00
Goffin Simon 6e06318828 [FIX] base: value = 0 for record ir_property
When a record is created with a field property of type integer or float equal to 0, there is
no record created in ir_property for this field. Then for a search of a record with this type of
field equal to 0, it must match all the records that have no corresponding property in the table
"ir.property" for this field.

ps: in 7.0, the function search_multi doesn't exist and the bug linked to cost price
doesn't happen because it's a float field.

opw:639746
2015-05-19 09:30:53 +02:00
Coin Newell 31d817e849 [FIX] web: rotate session identifiers after login/logout
As recommended by OWASP
https://www.owasp.org/index.php/Session_Management_Cheat_Sheet#Renew_the_Session_ID_After_Any_Privilege_Level_Change

Closes #6760
2015-05-19 01:45:46 +02:00
Denis Ledoux a4c7c564cf [FIX] stock_account: average cost in multi-company environment
When receiving goods with average price set as costing method,
for a move from another company than the SUPERUSER_id company,
the average price updated was the one from the SUPERUSER company
instead of the one of the move.

opw-634167
2015-05-18 11:49:55 +02:00
Raphael Collet 78a20a3dba [FIX] model: wrong alias used in read query for multi-inherited field
In commit 04ba0e99, we introduced an optimization for reading inherited fields
in a single query.  There is an issue when you have more than one level of
`_inherits`.  The query looks like:

    SELECT ...
    FROM table0, table1 AS alias1, table2 AS alias2
    WHERE table0.link0 = alias1.id AND table1.link1 = alias2.id AND ...
                                       ^^^^^^
                             should be alias1

This fixes the issue, and adds a test to reproduce it.  The fix is based on
@emiprotechnologies's own proposal, but is cleaner and does not break APIs.
2015-05-12 13:42:27 +02:00
Denis Ledoux 5d4560676e [FIX] res_users: action_id must be readable by the user
`action_id` is the loaded (window) action on user sign in.
It must thefore be readable by the user.

opw-634402
2015-05-12 11:33:43 +02:00
Christophe Simonis d8d3b38cbd [FIX] ir.logging: cursor should be in auto-commit 2015-05-11 19:01:37 +02:00
Christophe Simonis 04b252b72c [FIX] Cursor.closed property
`_obj` doesn't exists anymore when the cursor is effectively closed.
2015-05-11 16:24:33 +02:00
Raphael Collet fdc6ba1820 [FIX] http: make sure to instantiate an environment before calling method
This fixes an issue in property `field.digits` that cannot find a valid cursor
to the database.  Forcing the instantiation of an environment makes the cursor
retrievable.
2015-05-11 12:32:00 +02:00
Christophe Simonis 94aae97c04 [MERGE] forward port of branch saas-3 up to e2bfb96 2015-05-08 18:52:57 +02:00
Christophe Simonis e2bfb969ed [MERGE] forward port of branch 7.0 up to 6e23b2a 2015-05-08 18:10:30 +02:00
Christophe Simonis 1b5576af46 [FIX] sql_db: add `closed` property on `Cursor`. 2015-05-08 16:50:15 +02:00
Olivier Dony 6e23b2a807 [FIX] ir.model.data._update: create/modify XML IDs as super-user
When importing a CSV file with an "id" column containing
external IDs (XML IDs), the system automatically creates
or updates the corresponding ir.model.data entries.
This would fail for regular users who do not have
create/write access on this internal model.
2015-05-08 10:25:44 +02:00
Raphael Collet 5efac22043 [FIX] fields: when determining `digits()`, make sure to use a valid cursor 2015-05-07 16:56:26 +02:00
Denis Ledoux 547204b7f4 [IMP] logging: store logs in database in multi databases env.
The server parameter `log-db` gives the possibility
to store the logs of a server in a specific database,
in the ir.logging model.

Unfortunately, it wasn't possible to store these logs within
the database from which the logs came from in a multi databases
environment (e.g. the SAAS).

This revision gives the possibility to store the logs
within the database where the logs come from,
using --log-db=%d (inspired from the --db-filter arg)

We also added the possibility to change the level of logs to store in
the database, with the --log-db-level argument, which is set
by default to `warning`.
2015-05-07 15:11:58 +02:00
Denis Ledoux b7f1b9c01e [FIX] models: recompute nested old-style computed field
The `set` method of the one2many class returns a list
of the fields that require recomputation,
the computing of the function fields being delayed
for performances reasons.

Nevertheless, if the `set` method was called
through another `set` method, in other words,
nested `set` calls, the fields to recompute returned
by the second, nested, call to set were never recomputed,
the result list were simply lost.

e.g.:
```
create/write
│set
└─── create/write with recs.env.recompute set to False
    │set
        └─── create
             with recs.env.recompute set to False
```

To overcome this problem, the list of old api style
compute fields to recompute is stored
within the environment, and this list is cleared
each time the store_set_value has done its job of
recomputing all old api style compute fields.

opw-629650
opw-632624
closes #6053
2015-05-06 17:25:44 +02:00
Raphael Collet 1a535b9d87 [IMP] models: in recompute, do not store fields that should not be recomputed
Consider a new field that uses the same compute method as another existing
field.  When the field is introduced in database, its value must be computed on
existing records.  In such a case, the existing field should not be written, as
its value is not supposed to have changed.  Not writing on the existing field
can avoid useless recomputations in cascade, which is the reason we introduce
this patch.
2015-05-06 15:24:39 +02:00
Raphael Collet 3e497ea35f [FIX] registry: recompute `pure_function_fields` after every setup
The lazy property `pure_function_fields` was not invalidated upon every setup
of models, and hence could contain old instances of fields.  As every model
setup re-creates instances of fields, the property has to be recomputed.
2015-05-06 09:11:53 +02:00
Raphael Collet 0c665edb66 [FIX] models: make sure an environment is available when we access field.digits
Accessing `field.digits` can crash if no environment is available at that
point.  This happens in function `get_pg_type()`, which is called from method
`_auto_init()`.  An environment is simply created in the method's scope to be
available for `field.digits`.
2015-05-05 17:33:16 +02:00
Raphael Collet 071152216f [FIX] fields: when computing digits, use an existing cursor instead of a new one
The computation of property `digits` was creating a new cursor to call the
function that determines digits.  This technique is fragile because the current
cursor may have pending updates that the new cursor will not see.

The issue was discovered by Cécile Tonglet (cto).  She observed an infinite
loop during a database migration, and a traceback inside the loop showed the
presence of the `digits` property.  This change fixes the infinite loop issue.
2015-05-05 17:33:16 +02:00
Nicolas Martinelli 7feb9c112b [FIX] report,qweb: use non-beaking space between amount and currency
Fixes #6369
opw-633975
2015-05-05 08:27:04 +02:00
belkacem77 d377f5690e [ADD] base: Kabyle language
Add a new language: Kabyle language
2015-05-04 16:56:03 +02:00
Anthony Muschang 2925bb5c9a [FIX] models: Always use MissingError when a document is missing
As done in write and already in next version (see 0fd773a), accessing a deleted
record (through read or check access rights) should always return a MissingError
instead of the generic except_orm.
This will allow code ignoring deleted record (e.g. 'recompute' method) to safely
process the other records.
Fixes #6105
2015-05-04 13:39:21 +02:00
Nicolas Lempereur dd88f3c82f [FIX] search: searching fields.property not set
When searching if a many2one property field is not set, there may be less
results since only the ones with a reference set to NULL are returned.
We should also get those not in the table.

This commit change this case so instead of returning ['id', 'in', {matching non-set ids}],
the ['id', 'not in', {matching set ids}] is returned.

e.g: if (1, 3, 8) are set, (5, 9) are not set. ['id', 'not in', (1, 3, 8)] would
be returned instead of ['id', 'in', (5, 9)] which might not select all non-set
property fields.

closes #6044
opw-631057
2015-05-04 12:00:22 +02:00
Sylvain Calador fa18530210 [REF] Add a hook for import fake fields
Used during records extraction phase of import (CSV)

closes #6188
2015-04-29 10:42:56 +02:00
Olivier Dony 622e00baa5 [I18N] Sync 8.0 translations from Launchpad 2015-04-28 09:45:53 +02:00
Denis Ledoux cf4d14ce39 [MERGE] forward port of branch saas-3 up to 09b277c 2015-04-27 14:02:52 +02:00
Denis Ledoux d6ae7fb7db [MERGE] forward port of branch 7.0 up to 3e7d3c7 2015-04-27 12:19:43 +02:00
Thomas Rehn e8ffc09b30 [FIX] ir.ui.view (diagram): do not depend on semi-random order of _columns
The ir.ui.view.graph_get() method depended on the natural
semi-random order of Python dict keys in the _columns dict.

When the number and/or names of the _columns happened to
yield the o2m field of the "incoming transitions" *before*
the "outgoing transitions" of the "Node model"
(e.g. workflow activity), it would swap the incoming and
outgoing transitions fields around, causing a crash later
in the `tools.graph.process` method (currently an infinite
loop in the `tree_order()` method of tools.graph.py).

Closes #3614
Fixes https://bugs.launchpad.net/openobject-server/+bug/1316948
opw-633765
2015-04-24 13:50:26 +02:00
Martin Trigaux 68621de7df [ADD] base: Australian states
Fixes #6402
2015-04-23 16:47:42 +02:00
Nicolas Lempereur a8c122cd31 [FIX] ir.values: clear defaults cache when user company changes
The defaults of ir.values depends on the user company, but there is no
cache invalidation when the company of a user change.

This fix adds the clearing of the default's cache in this case.

Closes #6339
opw-629979
2015-04-22 18:50:43 +02:00
dhr-odoo cb5f00f580 [FIX] orm: ordering on >1000 records
When reading over IN_MAX (currently 1000) records, the select is slip into
subsets of IN_MAX records. However the list of ids was split using set() method
which removes order that may have been pass. The subsets are ordered using
_order attribute but the subsets were not ordered between themself.
This is an issue in case of browsing a o2m field with more than 1000 lines as it
will return sorted blocked but the order of the blocks is the order of the
contained ids (e.g. split(2, [5, 4, 3, 2, 1]) -> [[2,1], [4,3], [5]]).

Removes the set() to make sure the order of the given ids is preserved.
opw 616070, linked to #439
2015-04-22 12:14:33 +02:00
Denis Ledoux 64fd1dc636 [FIX] netsvc: logs to syslog
When starting the Odoo server with the parameters --syslog,
the logs are supposed to be pushed in the syslog.

This was no longer the case since e9d047e611.
Indeed, if no address is specified ('localhost', 514) is used,
which not always work. We therefore have no choice to define an address
which is '/var/run/log' for MacOSx,
and '/dev/log' for any other linux system.

opw-633074
2015-04-21 18:10:48 +02:00
Christophe Simonis 44059bce4b [MERGE] forward port of branch saas-3 up to 9323f2b 2015-04-20 12:11:15 +02:00
Christophe Simonis 9323f2b4c7 [MERGE] forward port of branch 7.0 up to a091de8 2015-04-20 12:10:48 +02:00
Christophe Simonis a091de8d8d [FIX] core: no traceback when closing socket.
Closes 5057
2015-04-20 11:54:58 +02:00
Christophe Simonis 13fec4a21c [FIX] core: avoid infinite recursive loop.
`function` fields are fully copied via `copy.copy()`.
`copy.copy()` *do not* call `__init__` after object creation; then
restore the state via `__setstate__()` or by updating `__dict__` or via
`setattr()` when the object uses `__slots__`.

As `__init__` is not called, the newly created object does not have any
`_args` attribute. This lead to a recursive call of `__getattr__ when
`copy.copy` check the existance of `__setstate__` attribute.

When break this loop by forbidding explicitly by checking the attribute
name accessed (We cannot check the presence of `_args` in `__dict__`
because we uses `__slots__`).

See http://bugs.python.org/issue5370
Fixes #6037
opw:633109
2015-04-20 11:00:09 +02:00
Ravi Gohil 3557fe124a [FIX] fields: timezone aware context_timezone
context_timestamp should always return a timezone aware timestamp, even when
no timezone is set on the user.
7f88681 fixed the bug in old api fields (openerp/osv/fields.py) but it was not
applied to new api fields (openerp/fields.py). opw 616612
2015-04-17 17:59:47 +02:00
Martin Trigaux 18a0ba302b [MERGE] forward port of branch saas-3 up to a939efd 2015-04-17 14:40:19 +02:00
Martin Trigaux a939efdb3f [MERGE] forward port of branch 7.0 up to 21d3be8 2015-04-17 14:23:21 +02:00
Alejandro Santana 21d3be87b3 [FIX] tools: image size as power of 2
Backport of 6a8f395
Fixes #5677
2015-04-17 14:17:19 +02:00
David Monjoie cd94f10e1d [FIX] base: fixed display of address in IE11
Spiritual backport of 5de677208c
which should have been fixed in 7.0 back then.
2015-04-16 14:27:12 +02:00
Christophe Simonis ba54a668d4 [MERGE] forward port of branch saas-3 up to 2ffbb5f 2015-04-14 12:12:39 +02:00
Christophe Simonis 2ffbb5f93d [MERGE] forward port of branch 7.0 up to d246e36 2015-04-14 11:40:23 +02:00
Christophe Simonis d1031c34ac [FIX] ormcache: correct stat counter usage. 2015-04-13 13:17:23 +02:00
Christophe Combelles 737728a7a0 [FIX] base: import po file with comments only
Do not crash when importing a po file with only comments lines (e.g.
autogenerated files)
Fixes #4887
2015-04-13 11:38:42 +02:00
Christophe Simonis d3e7a8ef5e [MERGE] forward port of branch 7.0 up to 856bc6f 2015-04-10 18:24:46 +02:00
Olivier Dony 856bc6f2b1 [FIX] apply same visibility rules as base 2015-04-10 17:15:50 +02:00
Olivier Dony 8d750ecdc8 [FIX] apply same visibility rules as base 2015-04-10 17:14:59 +02:00
Olivier Dony 56c95d2843 [FIX] report_sxw: setLang() should discard browse_record cache
`setLang` alters the "browse" context of the documents
being printed, but it must also discard any values
already cached, as they could be using a different language.
This is the case when the report uses translatable fields
on `res.partner`, because `setLang` is usually called
with the target partner language, hence prefetching
the translatable fields with the user's language instead
of the partner's language.

E.g. `setLang(o.partner_id.lang)` will cache any
translatable field on `o.partner_id` in the language of
the *user*, not the *partner*.
2015-04-07 18:33:49 +02:00
Ravi Gohil ffacce7140 [FIX] orm: export on empty one2many
When exporting the content of a one2many, if the first row got an empty value,
it was filled with the name_get of all lines and skipped the next lines.
The guessed reason of this was for the representation of the m2m lines but was
left after a proper export of m2m has been implemented (91cafbe).
This code was problematic as it prevented to properly export records with
an empty value on the first line (e.g. credit amount on account.move.line).
Fixes #4218, opw 620178
2015-04-07 15:54:01 +02:00
Christophe Simonis b5e1e14c5d [MERGE] forward port of branch saas-3 up to 59d82e6 2015-04-07 14:08:15 +02:00
Christophe Simonis 59d82e6fe7 [MERGE] forward port of branch 7.0 up to 5042d91 2015-04-07 13:36:01 +02:00
Christophe Simonis 5042d91330 [FIX] base: translation update
When updating translations, the source (`src`) is irrelevant for
`field` and `help` translations. Theses translation types are only
matched through their `name`.
2015-04-07 12:37:11 +02:00
Nicolas Lempereur bbeca2ddb3 [FIX] web: encoding css on multi page
In the small cases where utf-8 is not escaped in the CSS of a module*, an error
could happen when breaking minified CSS on multiple page (for IE9).

For the issue #5050

*currenlty for 8.0 : https://gist.github.com/nle-odoo/e353b22f89031ced21a5
2015-04-07 11:15:40 +02:00
Nicolas Lempereur b8b8329044 Revert "[FIX] web: set_cache want unicode when caching css"
This reverts commit e75e2ce2e5.
2015-04-07 10:55:24 +02:00
Nicolas Lempereur e75e2ce2e5 [FIX] web: set_cache want unicode when caching css 2015-04-07 10:29:33 +02:00
Nicolas Lempereur 37959d45f3 [FIX] qweb: css minified in multiple page for IE
On internet explorer 6, 7, 8 and 9, the limit of CSS rules in a stylesheet is
4095 (http://blogs.msdn.com/b/ieinternals/archive/2011/05/14/10164546.aspx).

This commit breaks down a CSS bundle in several pages for these IE versions.

To do this, the CSS tag added is of the kind : /web/css.0/{xmlid}/{version} in
which there is:

- the whole CSS if there is no more than one page,
- a list of @import pointing to the multiple pages.

note: if a modification lowers the number of page, an old page may stay in
ir_attachment (e.g: go from 4 to 3 pages, the old 4th page of another version
will not be deleted untill the number goes again up to 4).

Note: the method css(self) previously returned an unicode variable (the first
time) or an str variable (the following times, if already cached), the fix
also correct this so an str variable is always returned.

fixes #5050

opw-627116
2015-04-07 09:56:44 +02:00
Christophe Simonis 3171fd472e [FIX] core: correct LRU cleaning
Do not change dictionary size since during iteration
2015-04-03 16:33:18 +02:00
Christophe Simonis 14fd77c132 [FIX] core: ormcache is now per regisry.
A cross-registry cache was introduced by e2ea691ce.
The initial idea was praiseworthy but sub-optimal for servers with a
lot of registries.
When there is lot of registry loaded, the cache size was huge and
clearing some entries took a lot of CPU time, increasing the chances
of timeout.

Also, the cache was not cleaned when a registry is removed from
registry LRU (this operation would also consume time).
2015-04-03 16:11:57 +02:00
Christophe Combelles 3d11e6fae3 [FIX] ir_mail_server: _get_default_bounce_address
fails due to ir.config_parameter permission

At rev. 80017b04c2
ir.config_parameter model has been restricted to employees

Getting parameter from this model should therefore
be done as SUPERUSER_ID where the uid could
be a user which is not an employee.

Closes #5280
2015-04-03 12:54:25 +02:00
Denis Ledoux eaad70daac [FIX] ir_attachment: upload of attachment for non-employees
This rev. is related to eb9113c04d

if a model or a resource id is not defined on an attachment
restrict access to employees only if the creator
of this attachment is not the current user.

So non-employees can access their attachments without
models/resource id, which includes attachment of
discussions threads.

Fixes #4309
Closes #4310
2015-04-03 12:44:44 +02:00
Raphael Collet 9a365e83e7 [FIX] models: do not prefetch fields while the model schema is created
The following case has shown the issue: extend the model `res.company` by
adding at least two fields F and G, where F has a default value defined as:

    lambda self: self.env.user.company_id.name

If the column F is created before G in the database, the existing records will
be filled with the default value of F.  When the default value is computed, the
field `name` from a `res.company` is read, and other fields are prefetched,
including G.  This operation fails, because G does not exist in database yet!
2015-04-02 16:54:39 +02:00
Christophe Simonis ad55981b4b [IMP] base: url redirection through attachments
Special case for binary attachments with an url, when there is no data
to serve. If the attachment name is an url, redirect to this url,
otherwise return a 204 HTTP error.
2015-04-02 16:00:34 +02:00
Samus CTO 27d1199e90 [FIX] db manager: do not use registry to backup a database
Do not load registry to backup a database. This is
allows backing up databases whose registry cannot
be instantiated at the moment (wrong version, missing
modules, etc.)

Closes #5775
2015-04-02 10:10:04 +02:00
Denis Ledoux 90f998da0b [FIX] *: alias help message
When going to logged calls through opportunities,
and no logged calls were listed,
the mail alias of opportunities was displayed
within the placeholder help message,
wrongly, as we were in the logged calls list.

This was due to a context propagation, due
to have defined empty_list_help_* keys within
window actions. It was the case in several
modules.

Besides, we do not find the usefulness of the
custom_context passed to the get_empty_list_help
method: indeed, none of the methods get_empty_list_help
overriden in modules need any other keys than
'default_type', which do not require an evaluated
context.

We therefore remove the whole code regarding this
custom_context, and we therefore get rid of this
useless context evaluation thing within one of
the most accessed method of the web client.

opw-630673
2015-04-01 10:52:37 +02:00
Nicolas Lempereur 10c6fe4a6c [FIX] mail: make read more term translatable
opw-631860
2015-03-31 12:16:33 +02:00
Raphael Collet f2930c548e [IMP] ir_translation: improve usage of `ormcache` by method `_get_source`
Convert the arguments to avoid a cache error when the method is called with a
list of ids.
2015-03-31 10:12:14 +02:00
Olivier Dony f87570e83f [FIX] base: no cache for ir.attachment._filestore, restore context
Due to a compatibility problem between the new API
implementation and the @ormcache decorator, the
context parameter of ir.attachment._filestore()
was dropped at rev. 0beb14f0d2

However the need for caching this method has
disappeared in Odoo 8 (it used to require a
DB query). So it is even better to drop the
@ormcache decorator altogether, and keep the
context parameter.
This avoids a useless change of method signature,
even if that was on a private method.
2015-03-30 18:37:31 +02:00
Robert Rübner ff902f62e2 [FIX] base: update of source value in translation
Make sure pass a list of ids instead of a single id to write calls.
Some models (e.g. blog.post, fixed at 12fc5ea) are assuming that it got a list
of ids and is not checking the type.
Always pass a list of ids as it's the expected format for the orm.
2015-03-27 16:39:26 +01:00
Jos De Graeve 7e7ecf36f1 [FIX] service: error database in use on duplicate database
When trying to duplicate a database, while
having opened connections to it, postgresql throws

```
OperationalError: source database "duplicate_test"
is being accessed by other users
DETAIL:  There is 1 other session using the database.
```

Connections must be dropped before trying duplication
using TEMPLATE to avoid this.
2015-03-27 16:16:02 +01: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
FalcoBolger 95b921d0f7 [FIX] website: move support for ir.attachment resources to web module
Commit 540b753bf8 introduced
support for resources stored as ir.attachment records in
asset bundles too.
This is specifically useful for customizations.

However the HTTP route for reaching those resources
when they are *not* in a bundle was originally created
in the `website` module (as a special handling for
404 requests)

This means that these dynamic resources would only
be partially supported when `website` is not installed,
causing various problems:
 - missing resources in debug mode where bundles are skipped
 - errors when trying to define new client-side Qweb templates
   via XML resources - which are loaded with a direct request
 - ...

This commit moves back the supporting code to the web module.

The `mimetype` column is not present in ir.attachment without
the `website` module, but sniffing it based on the attachment
name works fine at serving time too.

Closes #6002
2015-03-26 17:33:19 +01:00
Raphael Collet c58121e8f1 [FIX] method `ir_model.check` now decorated with `ormcache_context`
The method needs the `context` parameter to translate the error message in case
the access is denied and an exception is raised.
2015-03-26 17:14:42 +01:00
Raphael Collet 0beb14f0d2 [FIX] ormcache: fix calls to `ormcache` with unexpected context parameter
The implementation of `ormcache` does not work on methods that take a `context`
parameter.  Because of the decorator `decorator`, the arguments of the call are
passed positionally to the method `ormcache.lookup`, and positional arguments
are used in the cache key.

The fix consists in removing the `context` parameter from the faulty methods,
either directly, or by caching a private method called by the public method.
2015-03-26 16:42:10 +01:00
Goffin Simon d79a1622bb [FIX] base: ir_filters: filters not in the language of the user
the context of the user must be used in get_filters to take into account
the language of the user.

opw:630057
2015-03-26 13:18:19 +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
Denis Ledoux a93ef48a70 [FIX] base: access to preferences menu for portal users
Since revs 53582c2ea6 & f65c913027,
this was no more possible for portal users to read groups
on purpose, for privacy reasons.

fields_get of res.users model is overriden, for
the access rights form view features
(The groups selections and checkboxes).
At each call to fields_get, which happens at each call
to fields_view_get on the res.users model, operations are
done on the model res.groups (basically, to
build the selection groups and checkboxes). So,
each time a view of model res.users is displayed,
whatever the view, operations on res.group model were performed.

The thing is, these operations on res.groups
are actually needed only for the user access rights
view, or at least only for users having the group
Administration > Access rights. These group operations
aren't needed for the preferences view, nor for portal users.

We therefore avoid to do these if the user is not part of the
Administration > Access rights group, which lead to
performances improvment, and solves the fact
portal users couldn't access their user preferences view.

opw-627391
2015-03-24 18:25:13 +01:00
Raphael Collet 5aa23f8280 [IMP] ormcache: compute hit/miss/err statistics per database
In ormcache, those statistic numbers were counted per cached method for all
registries.  We introduce separate statistic counters, and create a counter per
(database, model, method).  The existing attributes that are no longer used
have been removed.
2015-03-23 14:36:15 +01:00
Raphael Collet 68969c9716 [IMP] fields: avoid redundant slot in class many2one 2015-03-23 14:36:15 +01:00
Raphael Collet c0d79a78f0 [IMP] fields: rename methods to avoid collisions with `__slots__` names 2015-03-23 14:36:15 +01:00
Raphael Collet 524bb0a520 [IMP] fields: simplify the definition of `__slots__` via the `Field` metaclass 2015-03-23 14:36:15 +01:00
Raphael Collet b156c2e27e [IMP] registry: adapt LRU sizes for registries and ormcache
The registry size is now assumed to be around 10Mb, and ormcache size is
proportional to the maximum number of registries.  Statistics about ormcache
usage is shown to the log when receiving signal SIGUSR1.
2015-03-23 14:36:15 +01:00
Raphael Collet 93c341a52c [IMP] models: avoid using `map` instead of a `for` loop (thanks chs@odoo.com) 2015-03-23 14:36:15 +01:00
Raphael Collet f93a14e3b2 [IMP] fields: remove comments about `_all_columns`, and improve its docstring 2015-03-23 14:36:15 +01:00
Raphael Collet 1df3467888 [IMP] fields: remove unnecessary code
In `__getattr__`, remove the test on accessing `_attrs`.  This situation should
never happen, since the attribute `_attrs` is set in method `__init__()`.
2015-03-23 14:36:15 +01:00
Raphael Collet 4259fe0072 [IMP] openerp/osv/fields: add `__slots__` on all column classes
Use the same technique as for field classes.
This saves about 1.6Mb of memory per registry.
2015-03-23 14:36:15 +01:00
Raphael Collet e7928e1265 [IMP] fields: add `__slots__` on all fields
Introduce slots on all field classes for common attributes; slots take much
less memory than a `__dict__`.  The other attributes are stored in a dictionary
`_attrs`; all fields with an empty value for `_attrs` (common case) share the
same empty dictionary.  This saves quite some memory (around 4.5Mb per
registry), given the number of field instances created for a registry.

Another mechanism is used for the default values of attributes, since slots
cannot be assigned on classes.
2015-03-23 14:36:15 +01:00
Raphael Collet 915af86a91 [IMP] fields: simplify definition of ID field 2015-03-23 14:36:15 +01:00
Raphael Collet ffa7f28d34 [IMP] fields: reduce memory footprint of list/set field attributes
The optimization consists in using tuples for attributes `inverse_fields`,
`computed_fields` and `_triggers`, and to let them share their value when it is
empty, which is common.  This saves around 1.8Mb per registry.
2015-03-23 14:36:15 +01:00
Raphael Collet 3df7754087 [IMP] fields: reduce memory footprint of `field._attrs` and `column._args`
The optimization consists in sharing the dictionary when it is empty, which is
the common case.  This saves around 1.5Mb per registry.
2015-03-23 14:36:15 +01:00
Raphael Collet 4d232969a3 [IMP] fields: remove attribute `_free_attrs` and use `_attrs` instead
This saves about 400Kb per registry by not allocating those lists, which are in
most cases empty.  The removal of the attribute will also simplify a bit the
management of free attributes.
2015-03-23 14:36:15 +01:00
Raphael Collet 9aad3d873b [IMP] fields: turn field.digits and column.digits into dynamic properties
The computed value of parameter digits is no longer stored into fields and
columns; instead the value is recomputed everytime it is needed.  Note that
performance is not an issue, since the method `get_precision` of model
'decimal.precision' is cached by the orm.  This simplifies the management of
digits on fields and saves about 300Kb per registry.
2015-03-23 14:36:15 +01:00
Raphael Collet bf703fd9a3 [FIX] models: reorder the base classes of models following an equivalent class hierarchy
Sometimes, the expected mro of the model is not the same as the one built with
a binary class hierarchy.  So we reorder the base classes in order to match the
equivalent binary class hierarchy.  This also fixes the cases where duplicates
appear in base classes.
2015-03-23 14:36:14 +01:00
Raphael Collet 9bce04de79 [IMP] models: build a flat hierarchy of classes for models
Instead of composing classes in a binary tree hierarchy, we make one class that
inherits from all its base classes.  This avoids keeping intermediate data
structures for columns, inherits, constraints, etc.  This saves about 600Kb per
registry.
2015-03-23 14:36:14 +01:00
Raphael Collet 0f9b452c33 [IMP] models: convert deprecated model._all_columns into a dynamic property
The mappings model._all_columns takes quite some memory (around 2MB per
registry) because of the numerous dictionaries (one per model) and inefficient
memory storage of column_info.  Since it is deprecated and almost no longer
used, it can be computed on demand.
2015-03-23 14:36:14 +01:00
Raphael Collet e2ea691cef [IMP] ormcache: turn it into a global LRU cache shared among registries
The ormcache is now shared among registries.  The cached methods use keys like
(DBNAME, MODELNAME, METHOD, args...).  This allows registries with high load to
use more cache than other registries.
2015-03-23 14:36:14 +01:00
Dharmraj Jhala 01f2c5c9d2 [IMP] Allow custom ordering of files contained in zip dumps
This will allow to speed up our migration platform: as funzip can pipe
the output of the first file of the archive, even if the file is not
fully unzipped yet. This is useful to plays with dump.sql without waiting
for the full archive decompression.
2015-03-18 14:22:22 +01:00
Olivier Dony d93148240b [FIX] ir.model.data: update_dummy should mark `inherits` parents too
When a `noupdate` record is processed during an update,
the update_dummy method marks the record as "seen" so
it won't be deleted at the garbage collection step,
and seen as an obsolete external ID.

This needs to be done also for the parent records via
_inherits, because they have also received an implicit
external ID at creation, and must not be garbage
collected, even if their `noupdate` flag (db side)
is not set because the flag was added later.

This rare problem could be reproduced by creating a product
in a module, then referencing it in e.g. a sales order,
then updating the module after changing the product
record to be in a `noupdate` block.
At the end of the update the implicit product.template
record would be garbage collected, and trigger a cascade
deletion of its children - blocked by the SO reference
to the product.
2015-03-18 14:10:18 +01:00
Christophe Simonis e27744df0c [MERGE] forward port of branch saas-3 up to b79f64f 2015-03-18 13:16:23 +01:00
Christophe Simonis b79f64f1f8 [MERGE] forward port of branch 7.0 up to e1daaff 2015-03-18 12:52:33 +01:00
Raphael Collet 6aa28a89bb [FIX] models: compute many2many field on existing records when field is introduced by an update 2015-03-18 09:43:45 +01:00
Raphael Collet e182da22f4 [FIX] base/ir_model: upon custom field creation, always clear manual fields in registry
The invalidation in registry was done only if the field's model was already in
registry.  This situation is not the case when you create a custom model with a
custom field.
2015-03-17 11:51:22 +01:00
Raphael Collet 7ac4639a24 [FIX] fields: fix determination of `field.selection` for custom fields
In the case of custom fields, `field.selection` is set directly instead of
being set in overridden fields.
2015-03-16 15:34:16 +01:00
Thomas Groutars 7e0ff24cca [FIX] base: delete cascade value mapping on server action deletion
When deleting a server action, its fields_lines were not deleted.
It causes an issue for example in this case:

Create a new custom field on any model
Create a server action with
Action To Do: Write on a Record
Base model: model of the custom field
Add a line in the value mapping,
using the custom field you just created

Delete the server action

Delete the custom field => Throws an error because
required field col1 is not defined
on the ir_server_object_lines object
2015-03-13 11:25:08 +01:00
Fabien Pinckaers 4491c20bf0 Merge pull request #5728 from apertoso/8.0_fix_nl_BE_naming
[FIX] nl_BE language name
2015-03-12 15:28:07 -07:00
Thomas Groutars 3923f4051d [FIX] models: propagate context in action returned by get_formview_action
When opening a record from a many2one,
the context is not propagated to fields_view_get.
This is a problem if you set "form_view_ref" in the context for example.

opw-629628
2015-03-12 15:13:44 +01:00