diff options
| author | Jeremy Kersten <jke@odoo.com> | 2020-08-17 13:27:23 +0000 |
|---|---|---|
| committer | Jeremy Kersten <jke@odoo.com> | 2020-08-17 15:59:03 +0000 |
| commit | 73b4e9b1b671690a9d235459a6127da3603083a3 (patch) | |
| tree | 8a54c671bef30e3d27a70c2402e9dd571e449aa3 /addons/project | |
| parent | 5da1b96fbfda00af595fee747c9cbd76369a43c5 (diff) | |
[IMP] portal,*: /my counter async
Before this commit, the time to compute all counters was making the rendering
of the portal page slow.
Now the count is done in rpc after the loading of the page.
Now you can decide which part you want to show on the portal, and only compute
for these one.
It is not because you have purchase installed for your internal process, that
it means that your supplier use your portal and it avoid the computation for
all end users.
We parallelize the counters in arbitrary 3 rpcs.
closes odoo/odoo#55999
Related: odoo/enterprise#12456
Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>
Diffstat (limited to 'addons/project')
| -rw-r--r-- | addons/project/controllers/portal.py | 10 | ||||
| -rw-r--r-- | addons/project/views/project_portal_templates.xml | 10 |
2 files changed, 11 insertions, 9 deletions
diff --git a/addons/project/controllers/portal.py b/addons/project/controllers/portal.py index eef58fab633..f7480d3aedb 100644 --- a/addons/project/controllers/portal.py +++ b/addons/project/controllers/portal.py @@ -15,10 +15,12 @@ from odoo.osv.expression import OR class CustomerPortal(CustomerPortal): - def _prepare_home_portal_values(self): - values = super(CustomerPortal, self)._prepare_home_portal_values() - values['project_count'] = request.env['project.project'].search_count([]) - values['task_count'] = request.env['project.task'].search_count([]) + def _prepare_home_portal_values(self, counters): + values = super()._prepare_home_portal_values(counters) + if 'project_count' in counters: + values['project_count'] = request.env['project.project'].search_count([]) + if 'task_count' in counters: + values['task_count'] = request.env['project.task'].search_count([]) return values # ------------------------------------------------------------ diff --git a/addons/project/views/project_portal_templates.xml b/addons/project/views/project_portal_templates.xml index 9303df97472..49cd2f3218a 100644 --- a/addons/project/views/project_portal_templates.xml +++ b/addons/project/views/project_portal_templates.xml @@ -19,17 +19,17 @@ </xpath> </template> - <template id="portal_my_home" name="Portal My Home: project entries" inherit_id="portal.portal_my_home" priority="40"> + <template id="portal_my_home" name="Show Projects / Tasks" customize_show="True" inherit_id="portal.portal_my_home" priority="40"> <xpath expr="//div[hasclass('o_portal_docs')]" position="inside"> - <t t-if="project_count" t-call="portal.portal_docs_entry"> + <t t-call="portal.portal_docs_entry"> <t t-set="title">Projects</t> <t t-set="url" t-value="'/my/projects'"/> - <t t-set="count" t-value="project_count"/> + <t t-set="placeholder_count" t-value="'project_count'"/> </t> - <t t-if="task_count" t-call="portal.portal_docs_entry"> + <t t-call="portal.portal_docs_entry"> <t t-set="title">Tasks</t> <t t-set="url" t-value="'/my/tasks'"/> - <t t-set="count" t-value="task_count"/> + <t t-set="placeholder_count" t-value="'task_count'"/> </t> </xpath> </template> |
