From 2da7bc2adbbc6961959e2063ce22276fd7dd04de Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Wed, 12 Aug 2020 09:32:28 +0000 Subject: [PATCH] [REM] portal, *: remove archive_groups dead code PURPOSE Clean code and be and more performance oriented. SPECIFICATIONS Various portal pages hold references to archive_groups. It was a summary of customer documents for portal, containing a count of all documents split by model. Currently its computation is not used. Indeed archive_groups is displayed only in 'my_details' page that does not hold any document-based reference or code call. Other calls to archive_groups are dead code as the result is not used. Since 13.0 it is even not computed on standard pages to speedup their load (as it was not used). It is not used anymore and its computation and references can be removed safely, especially with v14 in mind for which we want to remove dead code to maintain. Followup of odoo/odoo#55228 LINKS Task ID-2329081 PR odoo/odoo#55800 PR #12368 closes odoo/odoo#56859 X-original-commit: e75086000ee4317b2ad2994db5d906fbcbd5081f Related: odoo/enterprise#12830 Signed-off-by: Thibault Delavallee (tde) Signed-off-by: Victor Feyens (vfe) --- addons/account/controllers/portal.py | 2 -- addons/portal/controllers/portal.py | 20 ------------------ addons/portal/views/portal_templates.xml | 21 ------------------- addons/project/controllers/portal.py | 7 +------ addons/purchase/controllers/portal.py | 2 -- addons/sale/controllers/portal.py | 6 +----- .../controllers/main.py | 9 ++------ 7 files changed, 4 insertions(+), 63 deletions(-) diff --git a/addons/account/controllers/portal.py b/addons/account/controllers/portal.py index 8723334ffcd..9766b27c276 100644 --- a/addons/account/controllers/portal.py +++ b/addons/account/controllers/portal.py @@ -58,7 +58,6 @@ class PortalAccount(CustomerPortal): filterby = 'all' domain += searchbar_filters[filterby]['domain'] - archive_groups = self._get_archive_groups('account.move', domain) if values.get('my_details') else [] if date_begin and date_end: domain += [('create_date', '>', date_begin), ('create_date', '<=', date_end)] @@ -81,7 +80,6 @@ class PortalAccount(CustomerPortal): 'invoices': invoices, 'page_name': 'invoice', 'pager': pager, - 'archive_groups': archive_groups, 'default_url': '/my/invoices', 'searchbar_sortings': searchbar_sortings, 'sortby': sortby, diff --git a/addons/portal/controllers/portal.py b/addons/portal/controllers/portal.py index c2c7901030b..548b72ef8e4 100644 --- a/addons/portal/controllers/portal.py +++ b/addons/portal/controllers/portal.py @@ -123,25 +123,6 @@ class CustomerPortal(Controller): _items_per_page = 20 - def _get_archive_groups(self, model, domain=None, fields=None, groupby="create_date", order="create_date desc"): - if not model: - return [] - if domain is None: - domain = [] - if fields is None: - fields = ['name', 'create_date'] - groups = [] - for group in request.env[model]._read_group_raw(domain, fields=fields, groupby=groupby, orderby=order): - dates, label = group[groupby] - date_begin, date_end = dates.split('/') - groups.append({ - 'date_begin': odoo_fields.Date.to_string(odoo_fields.Date.from_string(date_begin)), - 'date_end': odoo_fields.Date.to_string(odoo_fields.Date.from_string(date_end)), - 'name': label, - 'item_count': group[groupby + '_count'] - }) - return groups - def _prepare_portal_layout_values(self): """Values for /my/* templates rendering. @@ -156,7 +137,6 @@ class CustomerPortal(Controller): return { 'sales_user': sales_user, 'page_name': 'home', - 'archive_groups': [], } def _prepare_home_portal_values(self, counters): diff --git a/addons/portal/views/portal_templates.xml b/addons/portal/views/portal_templates.xml index 9ad2efaf9fb..75827fe8ac9 100644 --- a/addons/portal/views/portal_templates.xml +++ b/addons/portal/views/portal_templates.xml @@ -132,9 +132,6 @@
Edit Security Settings -
- -
@@ -351,24 +348,6 @@ - -