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/purchase/controllers | |
| 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/purchase/controllers')
| -rw-r--r-- | addons/purchase/controllers/portal.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/addons/purchase/controllers/portal.py b/addons/purchase/controllers/portal.py index c566963c32c..72a60ca2782 100644 --- a/addons/purchase/controllers/portal.py +++ b/addons/purchase/controllers/portal.py @@ -16,11 +16,12 @@ from odoo.addons.web.controllers.main import Binary class CustomerPortal(CustomerPortal): - def _prepare_home_portal_values(self): - values = super(CustomerPortal, self)._prepare_home_portal_values() - values['purchase_count'] = request.env['purchase.order'].search_count([ - ('state', 'in', ['purchase', 'done', 'cancel']) - ]) + def _prepare_home_portal_values(self, counters): + values = super()._prepare_home_portal_values(counters) + if 'purchase_count' in counters: + values['purchase_count'] = request.env['purchase.order'].search_count([ + ('state', 'in', ['purchase', 'done', 'cancel']) + ]) return values def _purchase_order_get_page_view_values(self, order, access_token, **kwargs): @@ -39,7 +40,6 @@ class CustomerPortal(CustomerPortal): @http.route(['/my/purchase', '/my/purchase/page/<int:page>'], type='http', auth="user", website=True) def portal_my_purchase_orders(self, page=1, date_begin=None, date_end=None, sortby=None, filterby=None, **kw): values = self._prepare_portal_layout_values() - partner = request.env.user.partner_id PurchaseOrder = request.env['purchase.order'] domain = [] |
