[Erp5-report] r17369 - /erp5/trunk/products/ERP5/tests/testAccounting.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Nov 2 17:37:27 CET 2007


Author: jerome
Date: Fri Nov  2 17:37:27 2007
New Revision: 17369

URL: http://svn.erp5.org?rev=17369&view=rev
Log:
test we can validate a payment transaction with an employee (member of the
group) and this does not require to set a bank account on the employee side.
fix some typos payment_module/payment_mode


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

Modified: erp5/trunk/products/ERP5/tests/testAccounting.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccounting.py?rev=17369&r1=17368&r2=17369&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccounting.py (original)
+++ erp5/trunk/products/ERP5/tests/testAccounting.py Fri Nov  2 17:37:27 2007
@@ -286,7 +286,7 @@
                portal_type='Payment Transaction',
                start_date=DateTime('2006/03/03'),
                destination_section_value=self.organisation_module.supplier,
-               payment_module='default',
+               payment_mode='default',
                lines=(dict(source_value=self.account_module.goods_purchase,
                            source_debit=500),
                       dict(source_value=self.account_module.receivable,
@@ -306,7 +306,7 @@
                stop_date=DateTime('2006/03/03'),
                source_section_value=self.organisation_module.supplier,
                destination_section_value=self.section, 
-               payment_module='default',
+               payment_mode='default',
                lines=(dict(destination_value=self.account_module.goods_purchase,
                            destination_debit=500),
                       dict(destination_value=self.account_module.receivable,
@@ -325,7 +325,7 @@
                portal_type='Accounting Transaction',
                start_date=DateTime('2006/12/31'),
                destination_section_value=self.organisation_module.supplier,
-               payment_module='default',
+               payment_mode='default',
                lines=(dict(source_value=self.account_module.goods_purchase,
                            source_debit=500),
                       dict(source_value=self.account_module.receivable,
@@ -336,7 +336,28 @@
         transaction, 'stop_action')
     transaction.setStartDate(DateTime("2007/01/01"))
     self.portal.portal_workflow.doActionFor(transaction, 'stop_action')
-
+  
+  def test_PaymentTransactionWithEmployee(self):
+    # we have to set bank account if we use an asset/cash/bank account, but not
+    # for our employees
+    transaction = self._makeOne(
+               portal_type='Accounting Transaction',
+               start_date=DateTime('2007/01/02'),
+               destination_section_value=self.person_module.john_smith,
+               payment_mode='default',
+               lines=(dict(source_value=self.account_module.bank,
+                           destination_value=self.account_module.bank,
+                           source_debit=500),
+                      dict(source_value=self.account_module.receivable,
+                           source_credit=500)))
+    # refused because no bank account
+    self.assertRaises(ValidationFailed,
+        self.portal.portal_workflow.doActionFor,
+        transaction, 'stop_action')
+    # with bank account, it's OK
+    bank_account = self.section.newContent(portal_type='Bank Account')
+    transaction.setSourcePaymentValue(bank_account)
+    self.portal.portal_workflow.doActionFor(transaction, 'stop_action')
 
 
 class TestClosingPeriod(AccountingTestCase):




More information about the Erp5-report mailing list