From 0c1fcef841dfd1c7fb96702eb5240a7c2ea146bb Mon Sep 17 00:00:00 2001 From: Albert Cervera i Areny Date: Thu, 26 Mar 2020 00:53:52 +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..4411865 --- /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 a086447d..0321bb6d 100644 +--- a/trytond/trytond/model/fields/many2one.py ++++ b/trytond/trytond/model/fields/many2one.py +@@ -23,7 +23,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 32d6a531..1f9c5cc2 100644 +--- a/trytond/trytond/model/modelstorage.py ++++ b/trytond/trytond/model/modelstorage.py +@@ -45,9 +45,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 af97f53..b3b0784 100644 --- a/series +++ b/series @@ -85,3 +85,5 @@ issue7856.diff # [stock] Can't move qty from a parent location to child location issue8058.diff # [stock_supply_production] Can't create productions from request because exceeds digits limit issue8252.diff # [account_tax_rule_country] Add subdivisiions to match account tax rule account_statement_message_invoice.diff # [account_statement] Add invoice number in amount_greater_invoice_amount_to_pay error message + +lazy_loading.diff