diff options
| author | Raphael Collet <rco@openerp.com> | 2016-03-24 16:30:45 +0100 |
|---|---|---|
| committer | Raphael Collet <rco@openerp.com> | 2016-04-25 13:37:11 +0200 |
| commit | f9b08f09b2c66eb24be79e6df2ef7fefaa6dac73 (patch) | |
| tree | 50a7ce08865e0744fec745424d6e8d25123e0e3e /openerp/fields.py | |
| parent | 8bc7d8565c3e4f954c479e3b51b863e4c03dc582 (diff) | |
[IMP] models: make `with_env`, `sudo`, `with_context` preserve the prefetch object
Diffstat (limited to 'openerp/fields.py')
| -rw-r--r-- | openerp/fields.py | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/openerp/fields.py b/openerp/fields.py index 62b8d47e384..9c9e6cdf7a1 100644 --- a/openerp/fields.py +++ b/openerp/fields.py @@ -1710,10 +1710,8 @@ class Many2one(_Relational): # many2one field value (id and name) depends on the current record's # access rights, and not the value's access rights. try: - # performance trick: make sure that all records prefetched with - # value will be prefetched with value_sudo - value_sudo = value.sudo().with_prefetch(value._prefetch) - return value_sudo.name_get()[0] + # performance: value.sudo() prefetches the same records as value + return value.sudo().name_get()[0] except MissingError: # Should not happen, unless the foreign key is missing. return False |
