From 0530b36a2dd5b7463b2b4e2d25e179436135f278 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 24 Oct 2018 09:09:38 +0000 Subject: [PATCH] [FIX] purchase: matching domain The domain used for the `purchase_count` variable should be in line with the domain used to retrieve the PO list at https://github.com/odoo/odoo/blob/68dafa0620fb8e36c9a1a58da0668bede2c3699b/addons/purchase/controllers/portal.py#L50 opw-1894625 closes odoo/odoo#28096 --- addons/purchase/controllers/portal.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/purchase/controllers/portal.py b/addons/purchase/controllers/portal.py index 3e7d39fb474..400b6ed51fa 100644 --- a/addons/purchase/controllers/portal.py +++ b/addons/purchase/controllers/portal.py @@ -14,8 +14,9 @@ class CustomerPortal(CustomerPortal): def _prepare_portal_layout_values(self): values = super(CustomerPortal, self)._prepare_portal_layout_values() - partner = request.env.user.partner_id - values['purchase_count'] = request.env['purchase.order'].search_count([]) + 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): @@ -98,4 +99,4 @@ class CustomerPortal(CustomerPortal): return request.redirect('/my') values = self._purchase_order_get_page_view_values(order_sudo, access_token, **kw) - return request.render("purchase.portal_my_purchase_order", values) \ No newline at end of file + return request.render("purchase.portal_my_purchase_order", values)