From 873920d94d02a9defd1ccab843ca8c73cf069cff Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Thu, 26 Mar 2020 01:00:35 +0100 Subject: [PATCH] Add lazy_loading.diff --- lazy_loading.diff | 29 +++++++++++++++++++++++++++++ series | 2 ++ 2 files changed, 31 insertions(+) create mode 100644 lazy_loading.diff diff --git a/lazy_loading.diff b/lazy_loading.diff new file mode 100644 index 0000000..0315ab9 --- /dev/null +++ b/lazy_loading.diff @@ -0,0 +1,29 @@ +diff --git a/trytond/model/fields/many2one.py b/trytond/model/fields/many2one.py +index 2a697c6f..12e94253 100644 +--- a/trytond/trytond/model/fields/many2one.py ++++ b/trytond/trytond/model/fields/many2one.py +@@ -22,7 +22,7 @@ class Many2One(Field): + ondelete='SET NULL', datetime_field=None, target_search='join', + help='', required=False, readonly=False, domain=None, states=None, + select=False, on_change=None, on_change_with=None, depends=None, +- context=None, loading='eager'): ++ context=None, 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 1d885ad1..87cb51b2 100644 +--- a/trytond/trytond/model/modelstorage.py ++++ b/trytond/trytond/model/modelstorage.py +@@ -48,9 +48,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('Name'), 'get_rec_name', + searcher='search_rec_name') + diff --git a/series b/series index 7d2e9a8..3b6f8db 100644 --- a/series +++ b/series @@ -86,3 +86,5 @@ change_key_tax.diff # Change the key tax use to not separrete refunds and invoic issue5907.diff # [trytond] Remove unoconv and call soffice directly issue9113.diff # [stock] ir.msg_read_error when read _history table when that not have history + +lazy_loading.diff # [trytond] https://discuss.tryton.org/t/should-create-uid-write-uid-use-lazy-loading/2458/7