summaryrefslogtreecommitdiff
path: root/addons/purchase
diff options
context:
space:
mode:
Diffstat (limited to 'addons/purchase')
-rw-r--r--addons/purchase/controllers/portal.py2
-rw-r--r--addons/purchase/tests/test_purchase_order_report.py25
2 files changed, 12 insertions, 15 deletions
diff --git a/addons/purchase/controllers/portal.py b/addons/purchase/controllers/portal.py
index 171373bbec5..73e2b2bbb3a 100644
--- a/addons/purchase/controllers/portal.py
+++ b/addons/purchase/controllers/portal.py
@@ -18,7 +18,7 @@ class CustomerPortal(CustomerPortal):
def _prepare_portal_layout_values(self):
values = super(CustomerPortal, self)._prepare_portal_layout_values()
- values['purchase_count'] = request.env['purchase.order'].search_count([
+ values['purchase_count'] = request.env['purchase.order'].sudo().search_count([
('state', 'in', ['purchase', 'done', 'cancel'])
])
return values
diff --git a/addons/purchase/tests/test_purchase_order_report.py b/addons/purchase/tests/test_purchase_order_report.py
index fe6e0b79ed4..8d157f3ace1 100644
--- a/addons/purchase/tests/test_purchase_order_report.py
+++ b/addons/purchase/tests/test_purchase_order_report.py
@@ -2,23 +2,20 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
-from odoo.tests import common, Form, tagged
-
+from odoo.tests import Form, tagged
+from odoo.addons.account.tests.account_minimal_test import AccountMinimalTest
@tagged('post_install', '-at_install')
-class TestPurchaseOrderReport(common.TransactionCase):
- def setUp(self):
- super(TestPurchaseOrderReport, self).setUp()
-
- self.partner_id = self.env.ref('base.res_partner_1')
- self.product1 = self.env.ref('product.product_product_8')
- self.product2 = self.env.ref('product.product_product_11')
- self.PurchaseReport = self.env['purchase.report']
+class TestPurchaseOrderReport(AccountMinimalTest):
- # Create a new company and set CoA
- self.company_id = self.env['res.company'].create({'name': 'new_company'})
- self.env.user.company_id = self.company_id
- self.env.ref('l10n_generic_coa.configurable_chart_template').try_loading()
+ @classmethod
+ def setUpClass(cls):
+ super(TestPurchaseOrderReport, cls).setUpClass()
+ cls.partner_id = cls.env['res.partner'].create({'name': 'A Partner'})
+ cls.product1 = cls.env['product.product'].create({'name': 'A First Product'})
+ cls.product2 = cls.env['product.product'].create({'name': 'A Second Product'})
+ cls.PurchaseReport = cls.env['purchase.report']
+ cls.company_id = cls.env.ref('base.main_company')
def test_00_purchase_order_report(self):
uom_dozen = self.env.ref('uom.product_uom_dozen')