Commit Graph

8015 Commits

Author SHA1 Message Date
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
Jos De Graeve 170674f994 Fix nl_BE language name 2015-03-12 15:08:10 +01:00
Nicolas Martinelli 2275af4b77 [FIX] base: ir sequence number is now reset to the requested value when calling the write method
opw: 626974
2015-03-11 11:35:25 +01:00
Julien Laloux a20545a936 [IMP] web: add no update info on metadata view (debug mode) 2015-03-11 11:10:42 +01:00
Olivier Dony edcbf067d6 [FIX] workflow.workitem: deleting a subflow should never cascade to workitems
It's always dangerous because (cascade-)deleting workitems
has a great chance of killing the workflow instances they
belong to, putting the records in the workflow limbo
permanently. (They will appear stuck as they don't have
enough workitems anymore)

In addition, in some rare cases a subflow activity is
converted into a regular activity during an update, and
nullifying the `subflow_id` column is all there is to
fixing the corresponding workitems. It will simply take
them out of their subflow, and back into the main flow.

This is the case for the modification of the purchase.order
workflow in Odoo 8 (saas-5), for the picking subflow.
2015-03-10 19:35:23 +01:00
Olivier Dony 13476c844d [FIX] fields.html, forum: opt-in stripping of @style attrs
For public-facing HTML content provided by the user,
`<style>` tags and `style` attributes should be stripped
automatically, as they can easily be abused to deface
pages for abusive users and spammers.
<style> tags were already stripped, the optional `strip_style`
for fields.html enables the automatic stripping of style
attributes.

This is opt-in because custom style attributes are still
desirable in trusted HTML fields.
2015-03-09 14:41:14 +01:00
Christophe Simonis 416f0246ac [MERGE] forward port of branch saas-3 up to 4a3c471 2015-03-09 12:03:22 +01:00
Christophe Simonis 4a3c4713e9 [MERGE] forward port of branch 7.0 up to 209ce6f 2015-03-09 11:24:32 +01:00
Laurent Mignon 6915ded51b [FIX] fixes #5616: use informations from self_fields to populate the ir.model.fields
Fields declared with the new API are converted to column only if they are storable. Use the informations from the field definitions to fill the ir.model.fields table since columns only contains stored field
2015-03-05 22:08:51 +01:00
Christophe Simonis 7bfd56d9c6 [FIX] base: correct test
Bad things happen when you write your code for master and
commit it in 8.0 without testing...
2015-03-04 13:38:36 +01:00
Christophe Simonis d6998061f1 [FIX] base: correct custom views validation.
As custom views validation is done while `self.pool._init` is set,
filter on currently loaded modules was still applied.
As a side effect, only one custom view per base view was validated.
In case this view is depending on another custom inherited view, the
validation failed.
Now force loading all views when validating custom views.
2015-03-04 12:49:06 +01:00
Christophe Simonis 325de62f51 [FIX] base: correct inheritance application
While `apply_inheritance_specs` apply most of its changes inplace, it may
completely replace the `arch_tree` if the root node is replaced.
This new root node wasn't used for `primary` views that inherit from
another.
2015-03-04 12:43:22 +01:00
Stefan Rijnhart 4781deb5b6 [FIX] base: Replace unreliable reference count through ORM by SQL
When the ORM is cleaning up related attachments upon record deletion, the
search() method hides the attachment of the record that is being deleted.
If the same file is used exactly once in another attachment, the reference
count will be 1 and the file will be deleted.
2015-03-04 11:23:44 +01:00
Xavier Morel 603c03799d [FIX] ir.qweb: ensure attributes are generated encoded
closes #2856, closes #4182
2015-03-03 17:04:20 +01:00
Raphael Collet 983dcf193c [FIX] fields: make base_field recursive in case a field is inherits'ed across several models 2015-03-03 13:18:04 +01:00
Raphael Collet 04ba0e99a4 [IMP] models: in _read_from_database(), fetch inherited fields when possible
This should improve the performance of method read() on models with inherited
fields, like product.product.  The inherited fields that are stored as columns
in parent tables (except for translated fields) are read in the same query as
the fields of the model.  Those fields will be directly stored in cache under
the main model, so that no copying will take place in cache for accessing them
(this is the default implementation of inherited fields).
2015-03-03 13:18:04 +01:00
Raphael Collet 2c261a2987 [IMP] models: in _read_from_database(), use the Query object to build the query
This makes the query construction more robust, as it handles joins for
conditions and ORDER BY clauses.  It also makes it easier to read() from
several tables (like inherited fields).
2015-03-03 13:18:04 +01:00
Raphael Collet 021c1a26c5 [IMP] fields: improve performance when reading many2one fields on records
Improve the performance of `name_get()` on many2one field values by making sure
that the records on which `name_get` is invoked are prefetched in cache.  This
is not automatic, because `name_get` is invoked on records in another
environment (sudo mode): the prefetching in the original environment should be
reproduced in the other environment.
2015-03-03 09:38:36 +01:00
FalcoBolger 714fe9135d [FIX] Signature on overriden fields_get method 2015-03-02 16:52:53 +01:00
David Monjoie 71e4d7145b [FIX] Scaffolding: moved two files to better reflect the architecture we currently use for our themes 2015-03-02 16:38:35 +01:00
Aaron Bohy 9ebfa11b8c [FIX] Packaging, Scaffolding: template files extension
Add .template as extension of the template files because RPM packaging
produces an error when trying to compile the python template files,
which contains Jinja instructions.

Include *.template files in MANIFEST.in to package them.
2015-03-02 16:38:34 +01:00
Holger Brunn 323233dd02 [FIX] ir_filters: return _auto_init's result
Closes #5204
2015-03-01 03:06:03 +01:00
Ravi Gohil 04de292885 [FIX] http: support old version of psutil
Add support for older versions of psutil (<1.2.0). Only used when
debug_rpc is enabled.

Closes #5108, #5163
2015-03-01 02:17:04 +01:00
Samus CTO fb285d8695 [FIX] prevent unneeded chmod datadir, but check writable 2015-02-27 17:16:16 +01:00
Christophe Simonis e6396deb4e [IMP] models: log source when "Comparing apples and oranges" 2015-02-27 15:57:13 +01:00
Xavier Morel 4bd2ee1aaa [FIX] undefined variable
Variable was added to an error message, then inlined in only one of the
two callsites. Undefined variable error would only appear when an error
is triggered in the actual (postgres-level) backup call.

inserted in ec9a543

fixes #5241
2015-02-27 15:07:15 +01:00
Xavier Morel 68f14c6870 [FIX] handling of big fields in CSV
fixes #2742
2015-02-27 14:11:21 +01:00
Christophe Simonis f0dc416871 [FIX] phantomjs 2.0 compatibility
phantomjs 2.0 remove the deprecated attribute `phantom.args`. Use the
new `system` module.
2015-02-26 15:08:17 +01:00
Raphael Collet 0c1b95d824 Merge pull request #5439 from guewen/test-inherits-3-levels
Reload fields of parent inherits, fixes #5398
2015-02-26 10:06:31 +01:00
Goffin Simon cbb51610ee [FIX] ir.ui.view: qweb translations: allow looking up translation in parent template
- Translations lookup normally uses the namespace of the current
QWeb template, after merging all inherited views.
But when a QWeb template is "cloned" by a child view using
inheritance with `primary` mode, the translations are more
likely to exist for the original (parent) template, and would not
be found when using only the "child" namespace.
This patch adds support for looking up each translation
also in the parent namespace in this case, if none was found
for the child template in the first place.

- ir.translation's _get_source() now supports a list of res_id
to search for, in addition to a single res_id

- Also moved the logic of routes /website/customize_template_get
and /website/get_view_translations to the ir.ui.view model where
it belongs.

opw: 615241

Closes #5325
2015-02-24 14:01:34 +01:00
David Monjoie 46186f54eb [FIX] openerp: fixed stretching of module icons in kanban view 2015-02-24 13:45:23 +01:00
Guewen Baconnier 608e58cce1 Reload fields of parent inherits, fixes #5398 2015-02-24 10:34:09 +01:00
Jeremy Kersten 0c964f0b7b [TYPO] modules: better safe than sorry
Too many people copy-past this line without understand !
2015-02-23 20:15:57 +01:00
Christophe Simonis a6a1764b2c [FIX] models: initialize `_fields` attribute.
Custom fields can point to custom models that have not been initialized
yet (`_setup_base` not called). Ensure every models in the registry
have a `_fields` attribute.
Use a `frozendict` as a defensive check to ensure it wont be modified
before calling `_setup_base`.
2015-02-23 18:33:26 +01:00
Raphael Collet 5ec8596f67 [FIX] fields: fix `_column.new()` by relying on `to_field_args()`
The implementation was based on the ill-defined method `same_parameters()` that
compares arguments based on a heuristic.  Instead, we now create a new column
and check whether it is equivalent to `self` by comparing the arguments
returned by `to_field_args()`.  If that is the case, `self` is reused instead
of the new column.

The code refactoring also fixes the column reuse which was broken by the
introduction of the parameter `compute` in commit 9333c62.  Indeed, with that
parameter, `same_parameters()` always returned False, since old-api columns do
not have that parameter by default.  The parameter has been renamed to
`_computed_field`, and is no longer passed for creating columns.
2015-02-23 15:50:09 +01:00
Raphael Collet 121b8e6800 [FIX] models: in onchange, false changes where detected in many2many fields
This was due to secondary fields loaded from database in 'onchange' mode.  In
that mode, the secondary fields were marked 'dirty', and therefore returned by
the method `onchange`.  The fix consists in loading those secondary fields in
cache before processing the onchanges.

This incidentally fixes a test on method `onchange`: in a one2many field, some
dirty fields were unexpectedly returned in the result.  This was due to those
fields being loaded while processing onchanges.
2015-02-21 11:29:13 +01:00
Denis Ledoux 2e7347dba5 [FIX] translate: possibility to disable translation of view nodes
Node content of inherited views using <attribute> tags are added
in the translation terms when syncing the terms.

The fact that the content should be translated or not depends
on the content, or to which attribute it refers.
For instance, string attributes should be translated, but
domains probably not.
But, even for domains, this is possible that it requires a translation
e.g. [('category_id.name', 'ilike', 'Customers')].
This domain is very unlikely to be integrated in the standard source code,
but this is possible to have such a domain in a view customization.

Therefore, we provide the possibility to disable the translation
case by case. Setting translation="off" in the attribute of the node
will prevent to add the node content in the translated terms.

opw-625762
2015-02-20 17:22:39 +01:00
Samus CTO 4ed38c2a92 [FIX] base: ambiguous @required for `name` of ir.actions subclasses
Column `name` is required in ir.actions, and thus
automatically required in subclasses such as `ir.actions.act_window`
and `ir.actions.act_url`, due to the specific PostgreSQL inheritance
mechanism. Mark it so in the model to make it explicit.
This does not change the database constraints, as they should already
be set though inheritance.

Closes #4861
2015-02-20 12:24:49 +01:00
Guewen Baconnier 461c93081d Add a failing test for write as well 2015-02-20 11:25:57 +01:00
Guewen Baconnier f7b9046c7b Add a failing test to reproduce #5398 2015-02-20 11:16:45 +01:00
Vicente Jimenez Aguilar 0892a088fc [FIX] report_webkit: multiple misspellings of wkhtmltopdf
closes #5392
2015-02-20 11:16:13 +01:00
Raphael Collet 9333c622e9 [FIX] fields: allow overriding of a old-api function field
When overriding a field defined as a function field, the field must either
create a corresponding column that is not a fields.function (if stored), or
have no corresponding column (if not stored).
2015-02-19 15:33:27 +01:00
Christophe Simonis bfb877a671 [FIX] ir.model.data: cleanup _process_end()
Allow deletion of ir.model and ir.model.fields when updating modules
Log xml id of deleted records
Remove xml id of non-existing records
2015-02-19 14:01:49 +01:00
Raphael Collet bf99f434c8 [IMP] models: speed up loading by computing `_constraint_methods` and `_onchange_methods` lazily 2015-02-18 16:43:20 +01:00
Raphael Collet 1439fcc40e [IMP] test_new_api: move test on delegate=True to module test_inherit
Group together the tests on fields that deal with _inherit and _inherits, and
avoid warnings about the field that uses delegate=True.
2015-02-18 16:43:20 +01:00
Raphael Collet 45a37b22fd [IMP] models: speedup loading of registry (-20%)
Idea: look up for the model's fields in method `_setup_base()` instead of
method `__init__()`.  This does not make a significant difference when
installing or upgrading modules, but when simply loading a registry, the
(expensive) field lookup is done once per model instead of once per class.
2015-02-18 16:43:20 +01:00
Olivier Dony e3ba594789 [I18N] Remove deprecated PO files (incorrect names)
Those files have already been replaced by
correctly named ones.

uk_UA.po -> uk.po
lt_LT.po -> lt.po
nl_NL.po -> nl.po
2015-02-18 12:11:51 +01:00
Olivier Dony 65e8115b8a [I18N] Update translations from Launchpad 8.0 branches (again), after syncing direct changes from 67bdc241bd 2015-02-18 11:58:13 +01:00
Olivier Dony 91d4b947f6 [I18N] Update translations from Launchpad 8.0 branches 2015-02-18 11:51:07 +01:00
Yenthe 67bdc241bd [FIX] incorrect etherpad url URL
closes #5287
2015-02-18 11:43:41 +01:00
Denis Ledoux 550910a8f6 [MERGE] forward port of branch 7.0 up to a87d60f 2015-02-16 18:26:45 +01:00
Denis Ledoux 3fed8ca58d [FIX] base: Address must stay readonly when field use_parent_address is checked
When you change the country of your company, each field of a company address keeps
its attrs. This is why the company address stays on readonly when use_parent_address
is checked.

Closes #4808
opw: 627033
2015-02-13 16:01:07 +01:00
Goffin Simon 5b283419d3 [FIX] base: Address must stay readonly when field use_parent_address is checked
When you change the country of your company, each field of a company address keeps
its attrs. This is why the company address stays on readonly when use_parent_address
is checked.

Closes #4808
opw: 627033
2015-02-13 11:35:00 +01:00
Denis Ledoux c9154e08aa [FIX] api: environment recomputation
In a workflow context (for instance, in the invoice workflow),
context is not passed.

Therefore, relying on the 'recompute' key being the context
in order to not recompute the fields does not work with Workflows.

It leads to huge performance issues,
as fields are recomputed recursively (instead of sequentially)
when several records are implied.
For instance, when reconciling several invoices with one payment
(100 invoices with 1 payment for instance),
records of each invoice are recomputed uselessly in each workflow call
(for each "confirm_paid" method done for each invoice).

With a significant number of invoices (100, for instance),
it even leads to a "Maximum recursion depth reached" errror.

closes #4905
2015-02-12 14:57:31 +01:00
Raphael Collet 13b36ac677 [IMP] fields: in selection fields, 'selection_add' only adds options not in selection yet 2015-02-11 13:31:17 +01:00
Raphael Collet 75ca4f8b71 [FIX] models: in onchange(), do not assign field 'id' on record 2015-02-11 12:45:18 +01:00
Raphael Collet 3a44d84b0f [FIX] models: inherited fields must be copied iff their original field is copied
This fixes a bug introduced by commit f650522bbf
(related fields should not be copied by default).  Inherited fields are a
particular case, and given the implementation of copy(), they must be copied if
their original field is copied.

The test on copy() in test_orm has been modified to show the bug.
2015-02-11 12:23:11 +01:00
Raphael Collet ac0eec6c99 [IMP] models: in recompute(), only save stored fields to database 2015-02-11 10:49:17 +01:00
Raphael Collet 2eb3ad2b46 [FIX] res_bank: fix onchange_partner_id(), where partner_id may be a NewId 2015-02-11 09:29:51 +01:00
Raphael Collet 6cf7bc8838 [FIX] models: invoke old-api onchange methods with context
This helps fixing old-api onchange methods with a record id as a parameter.
Browsing this record id may be problematic, since it reads the record in an
environment with an empty context.  This is really problematic when the record
is a new record, because such a record only exists in a given environment.
2015-02-11 09:29:51 +01:00
Raphael Collet 2067a206ec [FIX] models: process onchange methods on new records in the order of the view
The onchange() on new records processes fields in non-predictable order.  This
is problematic when onchange methods are designed to be applied after each
other.  The expected order is presumed to be the one of the fields in the view.

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

This fixes #4897.
2015-02-10 13:12:40 +01:00
Raphael Collet a11100adb8 [FIX] fields: new-api many2many fields always determine their table and columns
The mechanism to determine the table and column names of new-api many2many
fields only worked for many2many fields created from old-api many2many columns!

This fixes #4851.
2015-02-10 09:21:12 +01:00
Kiril Vangelovski ea60fed97a [FIX] tools.translate: use `request` to find `cr` and `lang` when other methods fail
Do it only after other direct methods fail,
to avoid ignoring a closer environement coming
from a calling frame.

+ Sign CLA

Closes #5148
2015-02-09 20:21:10 +01:00
Raphael Collet 4fd8e40ff7 [FIX] fields: add a flag "compute_sudo" to recompute fields as user admin
This reverts commit 8cd2cc8910.

It turned out that forcing recomputing fields as user admin breaks some
existing behavior.  Instead, we make the recomputation as user admin explicit
by adding compute_sudo=True in the field's definition.
2015-02-09 09:57:34 +01:00
Stefan Rijnhart 0fc5860fca [IMP] api decorator allow both res_id as well as id
As in python id is a builtin function name.

Closes: #5027
2015-02-09 01:10:36 +01:00
Jeremy Kersten 5a26c2d3ec [FIX] crm,hr,base: disable the quick create for country field
The creation of a country is not something to create at flight !
The impact could be bigger that what people was expected (no accounting configured, ...).

The bad manipulation is more often the responsible, eg 'Belgium ' was creating a new country with a trailing whitespace, while the user didn't see the difference and use both country withtout making the diff.
2015-02-05 14:14:59 +01:00
Christophe Simonis 7ab70cab74 [IMP] models.py: do not log handled "bad query" 2015-02-04 14:45:50 +01:00
Csaba Tóth ac845819ee [FIX] models: allow empty selection list
If a selection field is created with an empty list of choices (e.g. added by
submodules), initialise the field as a varchar column (most common).
Check if the list exists to avoid crashing while checking the type of the first
key.
Fixes #3810
2015-02-02 10:54:04 +01:00
Denis Ledoux 2883e3f67d [MERGE] forward port of branch saas-3 up to ba5c972 2015-01-30 16:55:36 +01:00
Denis Ledoux ba5c972c3e [MERGE] forward port of branch 7.0 up to 05c907b 2015-01-30 16:52:41 +01:00
Denis Ledoux 57cf6f814b [FIX] base: attachment security for SUPERUSER
If the superuser is not in the group employee,
we should nevertheless give him the access rights to attachments
2015-01-30 15:31:36 +01:00
Denis Ledoux 05c907b60b [FIX] res: currency, rates name_search
In currencies, advanced search with "equals" or "not equals" on rates
was not possible for something else than a date, in server format (crash).

This is because the name field of the model res.currency.rate is a date

This is now possible to search rates with just a float and the equal operators,
it returns currencies which are having at least one rate set to this float value

This is also possible to search rates with the equal operators with a date in
user (context) date format.
2015-01-30 15:04:20 +01:00
Jeremy Kersten 4a698da8b3 [IMP] qweb: Allow to propagate value to variables outside the loop.
If the variable was existing outside the context of the ``foreach``,
the value is copied at the end of the foreach into the global context.

Fix #4461 - Q74531 - Q71486 - Q71675
2015-01-30 14:26:48 +01:00
Xavier Morel 88cc816670 [IMP] http: don't warn when using HTTPException results
When returning an HTTPException e.g. by calling ``request.not_found()``
which returns a ``werkzeug.exceptions.NotFound()``, the http system
would log a warning as HTTPException is neither a subclass of Odoo's
Response nor a subclass of werkzeug's BaseResponse.

Move the string response case about (for flow clarity), and convert
HTTPException instances to Werkzeug responses then fall into the normal
BaseResponse -> Response case to ultimately get an Odoo response object
out of the HTTPException instance.
2015-01-29 16:15:36 +01:00
Raphael Collet f650522bbf [FIX] fields: related fields should not be copied by default 2015-01-29 14:43:50 +01:00
Olivier Laurent c49d20c61a [FIX] base: _auto_init change column type fix
When changing the type of a column (if size differs for example),
'selection' field should be considered like a 'char' field (since they
are internaly the same column type)

This will fix some migration issues where 'char' fields were correctly
changed but not 'selection,' field.

Use case:
* create a 6.0 db with 'stock' module installed
* 'state' field in 'stock.move' model is of type 'character varying(16)'
* migrate it to 8.0
* 'state' field is still 'character varying(16)' but should normally be
  'character varying'
2015-01-29 14:16:21 +01:00
Olivier Dony 801a8b8fa9 [MERGE] Forward-port latest saas-3 bugfixes, up to c9b690f6b6 2015-01-29 13:54:13 +01:00
Olivier Dony c9b690f6b6 [MERGE] Forward-port latest 7.0 bugfixes, up to 4c2706d685 2015-01-29 13:50:51 +01:00
Antony Lesuisse 06c681ba11 [FIX] base: add env to ir_action and ir_ui_view qweb context
To impel new api usage in server actions and qweb templates.
2015-01-28 23:48:23 +01:00
Samus CTO 7126ae8143 [FIX] mail: prevent sending mail during registry loading 2015-01-28 16:17:43 +01:00
Manuel Vázquez Acosta a4597fe34f [FIX] ir_mail_server: use local envelope sender rather than spoofing it
Acting as a mailing-list-like distribution system, the system used
to set the enveloper sender (aka bounce address) to the From header
of the message, effectively pretending to be the original sender.

In some cases the domain of the From header explicitly forbids
sending emails from external systems (e.g. with a hardfail SPF
record), so this could cause the email to be rejected by some
spam filters, depending on their policies.

The system will now use a local bounce address in the form:
  mail-catchall-alias@mail-catchall-domain
or, if no catchall is configured:
  postmaster-odoo@mail-catchall-domain
(as soon there is a mail.catchall.domain configured)
It will only fallback to using the From header when no
catchall domain is configured.

Fixes issue #3347.
Closes #3393.
2015-01-28 15:51:23 +01:00
Olivier Dony 7a0451d649 [FIX] safe_eval: no shadowing of PostgreSQL's exceptions
Letting PostgreSQL low-level exceptions bubble up
ensures that the mechanism for automatically
retrying transactions will work.
In case of transient errors such as deadlocks or
serialization errors, the transaction will be
transparently retried. Previously they were
transformed into ValueError and caused a permanent
failure immediately.

The fallback to ValueError is meant for invalid
expressions or expressions that use variables not
provided in the evaluation context. Other
exception types should be preserved (this is
further improved in Odoo 8)
2015-01-28 14:34:54 +01:00
Xavier Morel 426bcf427c [FIX] incorrect serialisation of log_handler
Saving log_handler to the config file is not currently special-cased,
the value is thus dumped as the repr() of the list, but not deserialized
with literal_eval. This means -s breaks log_handler and the
configuration file example is incorrect (it looks like a list).

Repeated -s further break the log_handler by interpreting the original
value as a string, putting it into a list, then reserialising that with
repr(), injecting a bunch of escaping backslash. The config file is soon
filled with backslashes and doubles in size with each new -s.

Furthermore for some reason the whole thing breaks --log-handler (and
aliases) entirely, once the wrong log_handler has been saved none of
them works anymore.

Fixes #4552
Closes #4157
2015-01-27 13:58:12 +01:00
Xavier Morel e9f0d79f85 [IMP] config: deduplicate loggers in log_handler
Saving multiple levels for the same logger should work with few issues,
but over time pathological (basket) cases (e.g. using ``-s`` all the
time) may build pointlessly huge lists in their config file.

Only keep the last level for each logger when saving to a config file.
2015-01-27 12:35:53 +01:00
Xavier Morel 8641826ca4 [IMP] config: make log_handler and --log-handler additive
For log_handler (list of logger configuration specs), having the
configuration file and the CLI configuration be exclusive (one
overwriting the other) is detrimental: it precludes keeping the
configuration file as a convenient baseline and only altering the subset
of loggers of interest at any given time. Combine specs from both
sources instead of overwriting one with the other.

* remove log_handler and its special case from the first options loop
* remove seeding of option with DEFAULT_LOG_HANDLER
* my_default is the baseline "configuration file" value, it's None if
  not provided which is not convenient. Use DEFAULT_LOG_HANDLER for it
  as baseline configuration file. DEFAULT_LOG_HANDLER isn't a list
  anymore, it's a CSV of logger specs (same as file-serialized)
* could actually use a DEFAULT_LOG_HANDLER of ``:`` (the default logger
  is root, the default level is info), but that might be a tad too
  cryptic
* things are weird between my_default and the file-sourced value,
  _parse_config is first run with my_defaults then with the file, but if
  there's no file it's re-run with already-parsed my_defaults. So when
  the file and the command-line values are of different type,
  _parse_config must be ready to handle both
2015-01-27 12:35:52 +01:00
Xavier Morel 9f4dea0891 [FIX] config: correctly serialize log_handler to CSV 2015-01-27 12:35:52 +01:00
Xavier Morel 23ad48a91b [FIX] config: a list is always equal to itself
add_option(action=append*) always modifies the ``default`` list
in-place. When using DEFAULT_LOG_HANDLER directly, that means
log_handler is always equal to DEFAULT_LOG_HANDLER since they're the
same list object. Thus the --log-handler command-line would never
overwrite the log_handler value from the configuration file, which is
unexpected

Fix that by copying DEFAULT_LOG_HANDLER before passing it as the
option's default value.
2015-01-27 12:35:51 +01:00
Olivier Dony 8e03852fd4 [I18N] Update translations from Launchpad 8.0 branches 2015-01-26 16:36:51 +01:00
Olivier Dony 740bf28907 [FIX] ir.model.data: verify record exists in _update_dummy
When a stale XML ID exists in the database, `_update_dummy()`
must consider it as missing entirely, and the next call
to `_update()` will take care of cleaning up the old XML ID.

Failing to do so for `noupdate` records means the `_update`
will never happen, and as soon as another record is created
or updated with a relationship to that stale XML ID, it will
plainly crash the installation/update.
2015-01-24 00:15:26 +01:00
Xavier Morel fca83b45f8 [IMP] on non-rpc debug, only break on non-HTTPException
Completes/improves fd6dde7ca

Because Werkzeug uses/provides flow-control exceptions via
HTTPException (which can be used as straight responses) they are used in
a few places of the web client, when triggering some redirections for
instance.

Breaking into the debugger for such mundane situations is surprising and
inconvenient for developers trying to debug actual issues in the system,
even though HTTPExceptions are by and large not error per-se, and
shouldn't warrant triggering post-mortem debugging.

So in the non-RPC dispatcher, don't post-mortem on HTTPException either.
2015-01-23 15:34:53 +01:00
Denis Ledoux dab5ff7e76 [MERGE] forward port of branch saas-3 up to b3f3daf 2015-01-23 13:28:17 +01:00
Denis Ledoux b3f3dafcb9 [MERGE] forward port of branch 7.0 up to c62a75a 2015-01-23 13:27:13 +01:00
Christophe Simonis 6d37ff1091 [FIX] base: remove duplicated XOF res.currency (and rate) 2015-01-23 13:02:30 +01:00
Christophe Simonis ce1096c447 [FIX] base: correct currency rate wrongly changed during 9902424 2015-01-23 12:57:04 +01:00
Denis Ledoux c62a75a5f3 [FIX] report: line splitting compatible with reportlab > 3.0
While keeping the compatibility for reportlab 2.5.

Splitting the text node on line breaks '\n' leaded to orphans ending tags,
like '</font>', which is regarded by reportlab 3.0 as a paragraph,
and reportlab therefore surrounded these tags by <para> tags,
which leaded to not syntax correct html like
<para></font></para>

To test this patch:
 - While having reportlab > 3.0
 - Create a rml report containing (at least) '<font>\n</font>'
 - Then print the report. It must not crash (obviously)
2015-01-23 12:54:30 +01:00
Aaron Bohy 3cae676619 [FIX] Use local copies of png instead of fetching them from websites
Debian does not allow fetching data from external website at runtime.
This fixes the privacy-breach-generic lintian warnings for Debian packaging.
The removed youtube url was a dead link...
2015-01-23 11:23:04 +01:00
Christophe Simonis 99024240f5 [IMP] base: avoid useless call to time.strftime()
This will also ease next forward-port 8.0 -> master
2015-01-22 18:27:08 +01:00
Christophe Simonis be33101903 [FIX] base: correct currency rates.
- Do not force creation of rates.
- Using rates of 2010 and storing them as beeing from 2015 is not a good idea.
2015-01-22 16:23:42 +01:00
Raphael Collet 8cd2cc8910 [FIX] models: recompute fields with user admin to prevent access rights issues 2015-01-22 15:32:18 +01:00
Denis Ledoux e9d1d7aac0 [MERGE] forward port of branch saas-3 up to c5775e5 2015-01-22 14:45:16 +01:00
Denis Ledoux c5775e56d3 [MERGE] forward port of branch 7.0 up to 25f5329 2015-01-22 14:43:06 +01:00