Commit Graph

7783 Commits

Author SHA1 Message Date
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