[Erp5-report] r21925 - /erp5/trunk/products/ERP5/tests/testPayroll.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jun 26 10:59:27 CEST 2008


Author: jerome
Date: Thu Jun 26 10:59:21 2008
New Revision: 21925

URL: http://svn.erp5.org?rev=21925&view=rev
Log:
when we unset variation settings categories from a model, it should use again
slice values from the inherited model

Modified:
    erp5/trunk/products/ERP5/tests/testPayroll.py

Modified: erp5/trunk/products/ERP5/tests/testPayroll.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testPayroll.py?rev=21925&r1=21924&r2=21925&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testPayroll.py (original)
+++ erp5/trunk/products/ERP5/tests/testPayroll.py Thu Jun 26 10:59:21 2008
@@ -1130,6 +1130,50 @@
     self.assertNotEqual(cell_c, None)
     self.assertEqual(cell_c.getQuantityRangeMin(), 4)
     self.assertEqual(cell_c.getQuantityRangeMax(), 5)
+
+
+  def test_model_slice_cell_range(self):
+    base_id = 'cell'
+    model_1 = self.paysheet_model_module.newContent(
+                            portal_type='Pay Sheet Model',
+                            variation_settings_category_list=
+                                  ('salary_range/france',))
+
+    model_2 = self.paysheet_model_module.newContent(
+                            portal_type='Pay Sheet Model',
+                            specialise_value=model_1,)
+
+    cell = model_1.newCell('salary_range/france/tranche_a',
+                    portal_type='Pay Sheet Model Slice',
+                    base_id='cell')
+    cell.setQuantityRangeMin(1)
+    cell.setQuantityRangeMax(2)
+    
+    # model 2 gets cell values from model 1 (see test_07_model_getCell)
+    self.assertEquals(1,
+        model_2.getCell('salary_range/france/tranche_a').getQuantityRangeMin())
+    self.assertEquals(2,
+        model_2.getCell('salary_range/france/tranche_a').getQuantityRangeMax())
+
+    # model 2 can override values
+    model_2.edit(variation_settings_category_list=('salary_range/france',))
+    cell = model_2.newCell('salary_range/france/tranche_a',
+                    portal_type='Pay Sheet Model Slice',
+                    base_id='cell')
+    cell.setQuantityRangeMin(3)
+    cell.setQuantityRangeMax(4)
+    self.assertEquals(3,
+        model_2.getCell('salary_range/france/tranche_a').getQuantityRangeMin())
+    self.assertEquals(4,
+        model_2.getCell('salary_range/france/tranche_a').getQuantityRangeMax())
+
+    # when unsetting variation settings category on this model will acquire
+    # again values from specialised model
+    model_2.edit(variation_settings_category_list=())
+    self.assertEquals(1,
+        model_2.getCell('salary_range/france/tranche_a').getQuantityRangeMin())
+    self.assertEquals(2,
+        model_2.getCell('salary_range/france/tranche_a').getQuantityRangeMax())
 
 
   def test_PaySheetTransaction_getMovementList(self):
@@ -2423,6 +2467,7 @@
     self.assertEquals(provider, line.getSourceSectionValue())
     
 
+
 import unittest
 def test_suite():
   suite = unittest.TestSuite()




More information about the Erp5-report mailing list