Commit Graph

307 Commits

Author SHA1 Message Date
Martin Trigaux 44248a07a5 [FIX] base,share: error in_group_xx on user form
res.users form contains virtual fields in_group_ID to be added in res.groups.
Groups with boolean share=True (added by share module) must not be displayed in
the form and should not be modifiable through the user interface.
However, if a module adding/modifying a res.group is earlier in the dependency
graph than 'share' (e.g. only depends from 'base'), the update of the user view
is done before share is loaded and the overrride of 'get_application_groups' is
never executed.

As we can not guarantee that the module is share loaded, put the logic of
hidding the module in base instead of share.

This workaround is quite hacky but is necessary in stable version.
Better fix in 9.0 at cf63d4d

Fixes #6324
Fixes #5820
2015-11-30 13:11:02 +01:00
Olivier Dony c345d294b1 [MERGE] Forward-port saas-3 up to rev. 10e6ad1355 2015-09-07 11:18:10 +02:00
Olivier Dony 10e6ad1355 [MERGE] Forward-port 7.0 up to rev. 20f69bbce9 2015-09-07 11:12:57 +02:00
Paul Catinean 20f69bbce9 [FIX] res.users: remove check_super duplication
Closes #8403
2015-09-07 11:07:43 +02:00
Christophe Simonis dac52e344c [FIX] models: "ORDER BY" on many2one fields
When ordering results on a many2one fields, results are ordered by
order of the target model. The code was wrongly assuming that this
`_order` attribute only contains `_classic_read` fields (that can be
directly read from the table in database). Now correctly generate the
"ORDER BY" clause using the current table alias.

`res.users` can now be sorted by name.
2015-08-14 15:42:37 +02:00
Christophe Simonis d5a6380726 [MERGE] forward port of branch 7.0 up to f410266 2015-08-11 16:35:00 +02:00
Olivier Dony fb55b2fa5e [FIX] res.users: more consistent handling of user private fields 2015-08-07 13:16:45 +02:00
Olivier Dony 5e4c09ae53 [FIX] res.users: more consistent handling of user private fields 2015-08-07 13:15:45 +02:00
Olivier Dony 77868ec4f9 [FIX] base, auth_openid: wrong implementation of API by auth_openid
Authentication modules are supposed to override res_users.check_credentials()
in order to plug in their own mechanism, without actually modifying the
behavior of res_users.check(), res_users.authenticate() or
res_users._login().

auth_openid was incorrectly overriding check() instead of
check_credentials(), and unnecessarily accessing private
attributes of res_users. Fixing the implementation of auth_openid
to follow the API means we can completely make those attributes
private.
2015-08-06 19:21:12 +02:00
Olivier Dony 54e06907c0 [FIX] base, auth_openid: wrong implementation of API by auth_openid
Authentication modules are supposed to override res_users.check_credentials()
in order to plug in their own mechanism, without actually modifying the
behavior of res_users.check(), res_users.authenticate() or
res_users._login().

auth_openid was incorrectly overriding check() instead of
check_credentials(), and unnecessarily accessing private
attributes of res_users. Fixing the implementation of auth_openid
to follow the API means we can completely make those attributes
private.
2015-08-06 19:19:17 +02:00
Raphael Collet 9699f510e4 [FIX] res_users: fix wrong index when parsing m2m commands 2015-08-05 14:35:42 +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
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
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
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
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
FalcoBolger 714fe9135d [FIX] Signature on overriden fields_get method 2015-03-02 16:52:53 +01:00
Denis Ledoux c5775e56d3 [MERGE] forward port of branch 7.0 up to 25f5329 2015-01-22 14:43:06 +01:00
Martin Trigaux 9f8731ca27 [FIX] base: backport of 152c5c2 to 7.0
[IMP] base: safer locking at user login

When a users connects, a lock is taken on the res_user table to modify the last login date. If another running transaction uses a foreign key to res.users (e.g. write_uid column), postgres may detect the update as a concurrent update and rollback the transaction.
In pg 9.3, the lock_strength parameter 'NO KEY' allows a weaker lock which is less likely to break another transaction.
Fixes #552
2015-01-22 13:34:19 +01:00
Denis Ledoux 87dd06c941 [MERGE] forward port of branch saas-3 up to 8c150c6 2015-01-15 14:43:32 +01:00
Denis Ledoux 8c150c609e [MERGE] forward port of branch 7.0 up to 7530d28 2015-01-15 13:37:30 +01:00
Sandy Carter 894143cb4c [FIX] res.groups: when generating initial group view, use admin context and language
This means group category names can be translated in the
default/installation database language.

Closes #3921
2015-01-15 11:54:22 +01:00
Denis Ledoux 6cb2c9edc6 [FIX] base: copy access rights on group duplication 2014-11-19 19:09:57 +01:00
Raphael Collet f2e4a10e1a [IMP] use model._fields instead of model._all_columns to cover all fields
The old-api model._all_columns contains information about model._columns and
inherited columns.  This dictionary is missing new-api computed non-stored
fields, and the new field objects provide a more readable api...

This commit contains the following changes:

 - adapt several methods of BaseModel to use fields instead of columns and
   _all_columns

 - copy all semantic-free attributes of related fields from their source

 - add attribute 'group_operator' on integer and float fields

 - base, base_action_rule, crm, edi, hr, mail, mass_mailing, pad,
   payment_acquirer, share, website, website_crm, website_mail: simply use
   _fields instead of _all_columns

 - base, decimal_precision, website: adapt qweb rendering methods to use fields
   instead of columns
2014-11-04 13:47:57 +01:00
Christophe Simonis 2e3f59181d [MERGE] forward port of branch saas-3 up to db75994 2014-10-14 15:13:14 +02:00
Olivier Dony edd94b623e [MERGE] Forward-port 7.0 up to 1b49a87 2014-10-10 19:21:18 +02:00
Denis Ledoux eeb1f0355c [FIX] res.users: exactly match login when operator in ilike, equal 2014-10-09 18:57:37 +02:00
Raphael Collet a69996b50c [IMP] fields: split multi-purpose '_origin' into 'column' and 'inherited'
This makes it easier to determine when a field interfaces a column, and when it
implements an inherited field (with _inherits).
2014-10-01 16:00:44 +02:00
Christophe Simonis a3704beefb [FIX] base: correct non-copy of `login_date` + adapt tests 2014-09-26 13:54:37 +02:00
Christophe Simonis e2e60bf4eb [MERGE] forward port of branch saas-3 up to fe8106f 2014-09-26 12:53:59 +02:00
Christophe Simonis fe8106fb85 [MERGE] forward port of branch 7.0 up to af37b30 2014-09-26 12:33:17 +02:00
Denis Ledoux 074c7b6c25 [FIX] res_users: do not copy login_date when duplicating users 2014-09-25 17:00:59 +02:00
Martin Trigaux 152c5c2b56 [IMP] base: safer locking at user login
When a users connects, a lock is taken on the res_user table to modify the last login date. If another running transaction uses a foreign key to res.users (e.g. write_uid column), postgres may detect the update as a concurrent update and rollback the transaction.
In pg 9.3, the lock_strength parameter 'NO KEY' allows a weaker lock which is less likely to break another transaction.
Fixes #552
2014-09-22 18:18:41 +02:00
Raphael Collet 68777c5860 [IMP] models: inherited fields are related fields read as the current user
Add an attribute 'related_sudo' (True by default) for related fields.
A related field is computed as superuser if related_sudo is True.

Add explicit related fields 'name' and 'email' on 'res.users', as these should
be readable by the public user with module website_forum.
2014-09-04 16:10:48 +02:00
Olivier Dony 2bbff57691 [IMP] hr,mail,product,project,base: use @auto_join=True on _inherits FK field
This can give a performance boost on large databases
and should not be a concern in terms of access control
as the inheritance already grants access to the parent
records.
2014-08-07 18:03:08 +02:00
Raphael Collet 6a83425ba9 [FIX] base: fixes #1167, change password wizard (wrong default value)
The one2many field 'user_ids' was initialized with an incorrect value for the
inverse field 'wizard_id', using a res.users id. The latter was causing a
MissingError exception. The fix is simply to not define explicitly the inverse
field in the one2many.

Also did a small cleanup of the code of the wizard.
2014-08-06 11:24:37 +02:00
Raphael Collet 56c54a52df [IMP] base/res_users: improve reading/writing of reified group fields
- simplify the code by removing unused cases
- do not modify input argument 'value' of create/write
- do not call BaseModel.read() with reified group fields (this causes warnings)
2014-08-05 14:17:11 +02:00
Olivier Dony f90b29b938 [FIX] res.users: safer read() when computing default company value
The goal is to avoid any kind of prefetching
of other fields when copmuting the default
company, as this will sometimes happen in the
middle of a database update, when the default
company is used for setting the default value
of new columns. In that case the db schema
may not fully match the in-memory model, leading
to an SQL error.
2014-07-25 16:33:48 +02:00
rlu-odoo 8b67a7202d [REF] OpenERP --> Odoo in various UI texts
Rebranding has been done in:
- data/demo files
- html templates
- help notices
- comments
- logger messages
- and other various messages

(Commit taken from odoo-dev:8.0-improve-openerp-odoo-rlu at rev 7deaa08)

Closes #1260
2014-07-18 13:45:41 +02:00
Olivier Dony 15174e9a70 [IMP] base, mail: cache user.has_group() + ir.ui.menu.load*()
Loading the menus is the most expensive
operation for an average page load, and
the result does not change often.
The menu filtering already uses a separate
cache based on groups, but the rest of the
loading includes reading actions and
translating menu names, which is also
expensive.

Added a cache keyed on user + user
lang, plus relevant cache invalidation
when any of the following are touched:
access rights, user data including
groups and language, menus or mail.group
subscriptions.

The menu filtering cache is still
useful in parallel has it is invalidated
under different conditions.

User.has_group() is cheap but still
called very often, so it is an easy
win as well, and also frequently
used when rendering page templates.
2014-07-17 18:46:10 +02:00
Christophe Matthieu fe64988ae2 [FIX] res.users: use read method to compute default values to don't create browse record and fetch all fields, browse record crash for install or update module 2014-07-17 18:46:09 +02:00
Raphael Collet cbe2dbb672 [MERGE] new v8 api by rco
A squashed merge is required as the conversion of the apiculture branch from
bzr to git was not correctly done. The git history contains irrelevant blobs
and commits. This branch brings a lot of changes and fixes, too many to list
exhaustively.

- New orm api, objects are now used instead of ids
- Environements to encapsulates cr uid context while maintaining backward compatibility
- Field compute attribute is a new object oriented way to define function fields
- Shared browse record cache
- New onchange protocol
- Optional copy flag on fields
- Documentation update
- Dead code cleanup
- Lots of fixes
2014-07-06 17:05:41 +02:00
Xavier Morel 40f7175172 [IMP] replace a manual & eager concat by chain.from_iterable(iter) -> iter 2014-07-04 10:58:41 +02:00
Olivier Dony c887e53b32 [FIX] web: force seession context reload when reloading client
The goal is to ensure that HTTP requests
done while reloading the client (e.g. the
menu bar, etc.) do not use a deprecated
session context.

Also undo the previous fix from a0ee2b5
as it would cause other issues (e.g.
prevent setting the admin password/lang
when creating a new db using the db manager)
This logic does not belong in the business
methods of res.users.
2014-07-02 15:18:56 +02:00
Simon Lejeune f8e9fde25b [FIX] correct context resetting when changing user lang 2014-06-30 21:10:15 +02:00
Amit Vora b592f9e13a [MERGE][IMP] Enable HTML in emails signature
Closes #801
2014-06-27 11:31:24 +02:00