From 5e3a32cab466ed9d183cef41b86efaa323b22da3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Wed, 15 Sep 2010 07:24:48 +0000
Subject: [PATCH] test usage of parent domain tree on a sale order for a user
 that does not have manager role.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38377 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testOrder.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/product/ERP5/tests/testOrder.py b/product/ERP5/tests/testOrder.py
index d41f74c736..b37504b0b5 100644
--- a/product/ERP5/tests/testOrder.py
+++ b/product/ERP5/tests/testOrder.py
@@ -2854,6 +2854,36 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
     self._testSubContentReindexing(order, [order_line, inner_order_line,
       order_cell])
 
+  def test_sale_order_view_parent_domain(self):
+    # test that arent domain can be used by non manager users
+    uf = self.portal.acl_users
+    uf._doAddUser(self.id(), '', ['Author', 'Member', 'Assignee'], [])
+    user = uf.getUserById(self.id()).__of__(uf)
+
+    newSecurityManager(None, user)
+    sale_order = self.portal.sale_order_module.newContent(
+                              portal_type='Sale Order')
+    sale_order.newContent(portal_type='Sale Order Line')
+    
+    selection_name = 'sale_order_line_selection'
+    self.assertEquals(selection_name,
+        sale_order.SaleOrder_view.listbox.get_value('selection_name'))
+    
+    # activate report tree
+    self.portal.portal_selections.setListboxDisplayMode(
+        self.portal.REQUEST, 'ReportTreeMode', selection_name)
+    self.portal.portal_selections.setSelectionParamsFor(
+        selection_name=selection_name,
+        params=dict(report_path="parent_domain",
+                    report_opened=1,
+                    report_tree_mode=1))
+
+    html = sale_order.view()
+    # report tree is used, and we had no error
+    self.assertTrue('listbox-table-report-tree-selection-cell' in html)
+    self.assertTrue('Object Tree' in html)
+
+
 def test_suite():
   suite = unittest.TestSuite()
   suite.addTest(unittest.makeSuite(TestOrder))
-- 
2.30.9