add lazy loading

This commit is contained in:
Àngel Àlvarez 2020-03-24 09:54:19 +01:00
parent 969b484f5c
commit f749c81e27
2 changed files with 30 additions and 0 deletions

29
lazy_loading.diff Normal file
View File

@ -0,0 +1,29 @@
diff --git a/trytond/model/fields/many2one.py b/trytond/model/fields/many2one.py
index 92ecf697..abb41628 100644
--- a/trytond/trytond/model/fields/many2one.py
+++ b/trytond/trytond/model/fields/many2one.py
@@ -25,7 +25,7 @@ class Many2One(Field):
search_order=None, search_context=None, help='', required=False,
readonly=False, domain=None, states=None, select=False,
on_change=None, on_change_with=None, depends=None, context=None,
- loading='eager'):
+ loading='lazy'):
'''
:param model_name: The name of the target model.
:param left: The name of the field to store the left value for
diff --git a/trytond/model/modelstorage.py b/trytond/model/modelstorage.py
index 9a7d4026..ba61dffd 100644
--- a/trytond/trytond/model/modelstorage.py
+++ b/trytond/trytond/model/modelstorage.py
@@ -92,9 +92,9 @@ class ModelStorage(Model):
"""
create_uid = fields.Many2One('res.user', 'Create User', readonly=True)
- create_date = fields.Timestamp('Create Date', readonly=True)
+ create_date = fields.Timestamp('Create Date', readonly=True, loading='lazy')
write_uid = fields.Many2One('res.user', 'Write User', readonly=True)
- write_date = fields.Timestamp('Write Date', readonly=True)
+ write_date = fields.Timestamp('Write Date', readonly=True, loading='lazy')
rec_name = fields.Function(fields.Char('Record Name'), 'get_rec_name',
searcher='search_rec_name')

1
series
View File

@ -77,3 +77,4 @@ statement_of_account.diff # [account] Cumulate balance of previous fiscal years
# issue8690.diff # Set company context in product instance
stock_supply.diff # [stock_supply] Force rounding in the quantity of internal shipment moves
issue9103.diff # [trytond] User-defined reports for custom template extensions
lazy_loading.diff # [trytond] lazy loading of id, create_date, write_date on many2one