[Erp5-report] r32992 kazuhiko - /erp5/trunk/products/ERP5/tests/testAccountingRules.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 23 07:34:58 CET 2010


Author: kazuhiko
Date: Tue Feb 23 07:34:58 2010
New Revision: 32992

URL: http://svn.erp5.org?rev=32992&view=rev
Log:
some checks for applied payment simulation rule.

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

Modified: erp5/trunk/products/ERP5/tests/testAccountingRules.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccountingRules.py?rev=32992&r1=32991&r2=32992&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccountingRules.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccountingRules.py [utf8] Tue Feb 23 07:34:58 2010
@@ -1232,7 +1232,22 @@
   def stepCheckPaymentRuleIsApplied(self, sequence, **kw) :
     """ checks that a payment rule is applied for the total amount
       of receivable """
-    # TODO
+    invoice_line = sequence.get('invoice_line')
+    simulation_movement = invoice_line.getDeliveryRelatedValue()
+    applied_rule_list = simulation_movement.objectValues()
+    # Invoice Transaction Rule and Trade Model Rule
+    self.assertEquals(2, len(applied_rule_list))
+    applied_rule = [x for x in applied_rule_list \
+                    if x.getSpecialiseReference() == \
+                    'default_invoice_transaction_rule'][0]
+    simulation_movement_list = [x for x in applied_rule.objectValues() \
+                                if x.getSourceTitle() in ('Receivable',
+                                                          'Payable')]
+    self.assertEquals(1, len(simulation_movement_list))
+    simulation_movement = simulation_movement_list[0]
+    applied_rule_list = simulation_movement.objectValues()
+    self.assertEquals(1, len(applied_rule_list))
+    payment_applied_rule = applied_rule_list[0]
 
   def stepPlanInvoice(self, sequence, **kw) :
     """ put the invoice in the `planned` state, which will




More information about the Erp5-report mailing list