Commit b6ccfc26 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_accounting: Migrate Unit Tests.

parent 719b21e3
...@@ -51,6 +51,7 @@ QUIET = 1 ...@@ -51,6 +51,7 @@ QUIET = 1
transaction_to_line_mapping = { transaction_to_line_mapping = {
'Accounting Transaction': 'Accounting Transaction Line', 'Accounting Transaction': 'Accounting Transaction Line',
'Balance Transaction': 'Balance Transaction Line', 'Balance Transaction': 'Balance Transaction Line',
'Internal Invoice Transaction': 'Internal Invoice Transaction Line',
'Purchase Invoice Transaction': 'Purchase Invoice Transaction Line', 'Purchase Invoice Transaction': 'Purchase Invoice Transaction Line',
'Sale Invoice Transaction': 'Sale Invoice Transaction Line', 'Sale Invoice Transaction': 'Sale Invoice Transaction Line',
'Payment Transaction': 'Accounting Transaction Line', 'Payment Transaction': 'Accounting Transaction Line',
...@@ -1083,7 +1084,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1083,7 +1084,7 @@ class TestClosingPeriod(AccountingTestCase):
period.setStartDate(DateTime(2006, 1, 1)) period.setStartDate(DateTime(2006, 1, 1))
period.setStopDate(DateTime(2006, 12, 31)) period.setStopDate(DateTime(2006, 12, 31))
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -1092,7 +1093,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1092,7 +1093,7 @@ class TestClosingPeriod(AccountingTestCase):
dict(source_value=self.account_module.stocks, dict(source_value=self.account_module.stocks,
source_credit=500))) source_credit=500)))
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -1173,7 +1174,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1173,7 +1174,7 @@ class TestClosingPeriod(AccountingTestCase):
portal_type='Account', portal_type='Account',
account_type='equity') account_type='equity')
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
...@@ -1183,7 +1184,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1183,7 +1184,7 @@ class TestClosingPeriod(AccountingTestCase):
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=100))) source_credit=100)))
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
destination_section_value=organisation_module.client_2, destination_section_value=organisation_module.client_2,
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
...@@ -1275,7 +1276,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1275,7 +1276,7 @@ class TestClosingPeriod(AccountingTestCase):
id='bank2', reference='bank2', id='bank2', reference='bank2',
portal_type='Bank Account') portal_type='Bank Account')
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
source_payment_value=bank1, source_payment_value=bank1,
...@@ -1288,7 +1289,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1288,7 +1289,7 @@ class TestClosingPeriod(AccountingTestCase):
source_credit=100))) source_credit=100)))
# we are destination on this one # we are destination on this one
transaction2 = self._makeOne( self._makeOne(
stop_date=DateTime(2006, 1, 2), stop_date=DateTime(2006, 1, 2),
destination_section_value=self.section, destination_section_value=self.section,
destination_payment_value=bank2, destination_payment_value=bank2,
...@@ -1400,7 +1401,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1400,7 +1401,7 @@ class TestClosingPeriod(AccountingTestCase):
account_type='equity') account_type='equity')
# 2 Transactions for clients 1 and 2 on ledger accounting/general # 2 Transactions for clients 1 and 2 on ledger accounting/general
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/general', ledger='accounting/general',
...@@ -1411,7 +1412,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1411,7 +1412,7 @@ class TestClosingPeriod(AccountingTestCase):
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=100))) source_credit=100)))
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/general', ledger='accounting/general',
...@@ -1423,7 +1424,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1423,7 +1424,7 @@ class TestClosingPeriod(AccountingTestCase):
source_credit=200))) source_credit=200)))
# 2 Transactions for clients 1 and 2 on ledger accounting/detailed # 2 Transactions for clients 1 and 2 on ledger accounting/detailed
transaction3 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/detailed', ledger='accounting/detailed',
...@@ -1434,7 +1435,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1434,7 +1435,7 @@ class TestClosingPeriod(AccountingTestCase):
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=400))) source_credit=400)))
transaction4 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/detailed', ledger='accounting/detailed',
...@@ -1568,7 +1569,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1568,7 +1569,7 @@ class TestClosingPeriod(AccountingTestCase):
account_type='equity') account_type='equity')
# 2 Transactions for clients 1 and 2 on ledger accounting/general # 2 Transactions for clients 1 and 2 on ledger accounting/general
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/general', ledger='accounting/general',
...@@ -1579,7 +1580,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1579,7 +1580,7 @@ class TestClosingPeriod(AccountingTestCase):
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=100))) source_credit=100)))
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/general', ledger='accounting/general',
...@@ -1591,7 +1592,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1591,7 +1592,7 @@ class TestClosingPeriod(AccountingTestCase):
source_credit=200))) source_credit=200)))
# 2 Transactions for clients 1 and 2 on ledger accounting/detailed # 2 Transactions for clients 1 and 2 on ledger accounting/detailed
transaction3 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/detailed', ledger='accounting/detailed',
...@@ -1602,7 +1603,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1602,7 +1603,7 @@ class TestClosingPeriod(AccountingTestCase):
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=400))) source_credit=400)))
transaction4 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
ledger='accounting/detailed', ledger='accounting/detailed',
...@@ -1732,7 +1733,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1732,7 +1733,7 @@ class TestClosingPeriod(AccountingTestCase):
period.setStartDate(DateTime(2006, 1, 1)) period.setStartDate(DateTime(2006, 1, 1))
period.setStopDate(DateTime(2006, 12, 31)) period.setStopDate(DateTime(2006, 12, 31))
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
title='Yen', title='Yen',
resource='currency_module/yen', resource='currency_module/yen',
...@@ -1746,7 +1747,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1746,7 +1747,7 @@ class TestClosingPeriod(AccountingTestCase):
source_asset_credit=1.1, source_asset_credit=1.1,
source_credit=100))) source_credit=100)))
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
title='Dollar', title='Dollar',
resource='currency_module/usd', resource='currency_module/usd',
...@@ -1889,7 +1890,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1889,7 +1890,7 @@ class TestClosingPeriod(AccountingTestCase):
period.setStartDate(DateTime(2006, 1, 1)) period.setStartDate(DateTime(2006, 1, 1))
period.setStopDate(DateTime(2006, 12, 31)) period.setStopDate(DateTime(2006, 12, 31))
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
title='Yen', title='Yen',
resource='currency_module/yen', resource='currency_module/yen',
...@@ -1903,7 +1904,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -1903,7 +1904,7 @@ class TestClosingPeriod(AccountingTestCase):
source_asset_credit=1.1, source_asset_credit=1.1,
source_credit=100))) source_credit=100)))
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
title='Dollar', title='Dollar',
resource='currency_module/usd', resource='currency_module/usd',
...@@ -2028,7 +2029,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2028,7 +2029,7 @@ class TestClosingPeriod(AccountingTestCase):
self.assertEqual('started', period.getSimulationState()) self.assertEqual('started', period.getSimulationState())
# create a simple transaction in the period # create a simple transaction in the period
accounting_transaction = self._makeOne( self._makeOne(
start_date=DateTime(2006, 6, 30), start_date=DateTime(2006, 6, 30),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -2082,7 +2083,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2082,7 +2083,7 @@ class TestClosingPeriod(AccountingTestCase):
period.setStopDate(DateTime(2006, 12, 31)) period.setStopDate(DateTime(2006, 12, 31))
period.start() period.start()
transaction_main = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
destination_section_value=self.main_section, destination_section_value=self.main_section,
...@@ -2156,7 +2157,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2156,7 +2157,7 @@ class TestClosingPeriod(AccountingTestCase):
period_section.setStopDate(DateTime(2006, 12, 31)) period_section.setStopDate(DateTime(2006, 12, 31))
period_section.start() period_section.start()
transaction_main = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
destination_section_value=self.main_section, destination_section_value=self.main_section,
...@@ -2239,7 +2240,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2239,7 +2240,7 @@ class TestClosingPeriod(AccountingTestCase):
period.setStopDate(DateTime(2006, 12, 31)) period.setStopDate(DateTime(2006, 12, 31))
period.start() period.start()
transaction_main = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
destination_section_value=self.main_section, destination_section_value=self.main_section,
...@@ -2271,7 +2272,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2271,7 +2272,7 @@ class TestClosingPeriod(AccountingTestCase):
period1.setStopDate(DateTime(2006, 12, 31)) period1.setStopDate(DateTime(2006, 12, 31))
period1.start() period1.start()
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 2), start_date=DateTime(2006, 1, 2),
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
source_section_value=self.organisation_module.client_1, source_section_value=self.organisation_module.client_1,
...@@ -2301,7 +2302,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2301,7 +2302,7 @@ class TestClosingPeriod(AccountingTestCase):
period2.setStopDate(DateTime(2007, 12, 31)) period2.setStopDate(DateTime(2007, 12, 31))
period2.start() period2.start()
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2007, 1, 2), start_date=DateTime(2007, 1, 2),
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -2309,7 +2310,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2309,7 +2310,7 @@ class TestClosingPeriod(AccountingTestCase):
source_debit=100), source_debit=100),
dict(source_value=pl_account, dict(source_value=pl_account,
source_credit=100))) source_credit=100)))
transaction3 = self._makeOne( self._makeOne(
start_date=DateTime(2007, 1, 3), start_date=DateTime(2007, 1, 3),
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
source_section_value=self.organisation_module.client_1, source_section_value=self.organisation_module.client_1,
...@@ -2371,7 +2372,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2371,7 +2372,7 @@ class TestClosingPeriod(AccountingTestCase):
title='Profit & Loss') title='Profit & Loss')
pl_account.validate() pl_account.validate()
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -2495,7 +2496,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2495,7 +2496,7 @@ class TestClosingPeriod(AccountingTestCase):
portal_type='Account', portal_type='Account',
account_type='equity') account_type='equity')
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
...@@ -2647,7 +2648,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2647,7 +2648,7 @@ class TestClosingPeriod(AccountingTestCase):
def test_InventoryIndexingNodeDiffOnNode(self): def test_InventoryIndexingNodeDiffOnNode(self):
# Balance Transactions are indexed as Inventories. # Balance Transactions are indexed as Inventories.
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -2735,7 +2736,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2735,7 +2736,7 @@ class TestClosingPeriod(AccountingTestCase):
def test_BalanceTransactionLineBrainGetObject(self): def test_BalanceTransactionLineBrainGetObject(self):
# Balance Transaction Line can be retrieved using Brain.getObject # Balance Transaction Line can be retrieved using Brain.getObject
existing_transaction = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 31), start_date=DateTime(2006, 1, 31),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -2796,7 +2797,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2796,7 +2797,7 @@ class TestClosingPeriod(AccountingTestCase):
def test_BalanceTransactionLineBrainGetObjectDifferentThirdParties(self): def test_BalanceTransactionLineBrainGetObjectDifferentThirdParties(self):
# Balance Transaction Line can be retrieved using Brain.getObject, when # Balance Transaction Line can be retrieved using Brain.getObject, when
# the balance is for different third parties # the balance is for different third parties
existing_transaction = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 30), start_date=DateTime(2006, 1, 30),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -2805,7 +2806,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2805,7 +2806,7 @@ class TestClosingPeriod(AccountingTestCase):
source_debit=30), source_debit=30),
dict(source_value=self.account_module.goods_sales, dict(source_value=self.account_module.goods_sales,
source_credit=30))) source_credit=30)))
another_existing_transaction = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 31), start_date=DateTime(2006, 1, 31),
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
simulation_state='delivered', simulation_state='delivered',
...@@ -2866,7 +2867,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2866,7 +2867,7 @@ class TestClosingPeriod(AccountingTestCase):
# check that dates are correctly used for Balance Transaction indexing # check that dates are correctly used for Balance Transaction indexing
organisation_module = self.organisation_module organisation_module = self.organisation_module
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 12, 31), start_date=DateTime(2006, 12, 31),
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
...@@ -2881,11 +2882,11 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2881,11 +2882,11 @@ class TestClosingPeriod(AccountingTestCase):
destination_section_value=self.section, destination_section_value=self.section,
start_date=DateTime(2007, 1, 1), start_date=DateTime(2007, 1, 1),
resource_value=self.currency_module.euro,) resource_value=self.currency_module.euro,)
balance_line = balance.newContent( balance.newContent(
portal_type='Balance Transaction Line', portal_type='Balance Transaction Line',
destination_value=self.account_module.equity, destination_value=self.account_module.equity,
destination_debit=100,) destination_debit=100,)
balance_line = balance.newContent( balance.newContent(
portal_type='Balance Transaction Line', portal_type='Balance Transaction Line',
source_section_value=organisation_module.client_1, source_section_value=organisation_module.client_1,
destination_value=self.account_module.receivable, destination_value=self.account_module.receivable,
...@@ -2907,7 +2908,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2907,7 +2908,7 @@ class TestClosingPeriod(AccountingTestCase):
# this is a transaction with the same date as the balance transaction, but # this is a transaction with the same date as the balance transaction, but
# this transaction should not be taken into account when we reindex the # this transaction should not be taken into account when we reindex the
# Balance Transaction. # Balance Transaction.
transaction2 = self._makeOne( self._makeOne(
start_date=DateTime(2007, 1, 1), start_date=DateTime(2007, 1, 1),
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
...@@ -2940,7 +2941,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2940,7 +2941,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_section_value=self.section, destination_section_value=self.section,
start_date=DateTime(2006, 12, 31), start_date=DateTime(2006, 12, 31),
resource_value=self.currency_module.euro,) resource_value=self.currency_module.euro,)
balance_line = balance.newContent( balance.newContent(
portal_type='Balance Transaction Line', portal_type='Balance Transaction Line',
destination_value=self.account_module.receivable, destination_value=self.account_module.receivable,
destination_debit=100,) destination_debit=100,)
...@@ -2977,7 +2978,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -2977,7 +2978,7 @@ class TestClosingPeriod(AccountingTestCase):
destination_section_value=self.section, destination_section_value=self.section,
start_date=DateTime(2006, 12, 31), start_date=DateTime(2006, 12, 31),
resource_value=self.currency_module.euro,) resource_value=self.currency_module.euro,)
balance_line = balance.newContent( balance.newContent(
portal_type='Balance Transaction Line', portal_type='Balance Transaction Line',
destination_value=self.account_module.receivable, destination_value=self.account_module.receivable,
destination_debit=100,) destination_debit=100,)
...@@ -3009,7 +3010,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -3009,7 +3010,7 @@ class TestClosingPeriod(AccountingTestCase):
portal_type='Account', portal_type='Account',
account_type='equity') account_type='equity')
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
...@@ -3057,7 +3058,6 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -3057,7 +3058,6 @@ class TestClosingPeriod(AccountingTestCase):
def test_ParrallelClosingRefused(self): def test_ParrallelClosingRefused(self):
organisation_module = self.organisation_module organisation_module = self.organisation_module
stool = self.portal.portal_simulation
period = self.section.newContent(portal_type='Accounting Period') period = self.section.newContent(portal_type='Accounting Period')
period.setStartDate(DateTime(2006, 1, 1)) period.setStartDate(DateTime(2006, 1, 1))
period.setStopDate(DateTime(2006, 12, 31)) period.setStopDate(DateTime(2006, 12, 31))
...@@ -3071,7 +3071,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -3071,7 +3071,7 @@ class TestClosingPeriod(AccountingTestCase):
portal_type='Account', portal_type='Account',
account_type='equity') account_type='equity')
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
...@@ -3097,11 +3097,11 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -3097,11 +3097,11 @@ class TestClosingPeriod(AccountingTestCase):
period.setStopDate(DateTime(2006, 12, 31)) period.setStopDate(DateTime(2006, 12, 31))
period.start() period.start()
pl = self.portal.account_module.newContent( self.portal.account_module.newContent(
portal_type='Account', portal_type='Account',
account_type='equity') account_type='equity')
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
destination_section_value=organisation_module.client_1, destination_section_value=organisation_module.client_1,
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
...@@ -3131,7 +3131,7 @@ class TestClosingPeriod(AccountingTestCase): ...@@ -3131,7 +3131,7 @@ class TestClosingPeriod(AccountingTestCase):
# This transaction has lines that should block closing for `main_section`, # This transaction has lines that should block closing for `main_section`,
# but not for `section` because from `section` side there are no accounting lines. # but not for `section` because from `section` side there are no accounting lines.
transaction1 = self._makeOne( self._makeOne(
start_date=DateTime(2006, 1, 1), start_date=DateTime(2006, 1, 1),
source_section_value=self.main_section, source_section_value=self.main_section,
source_value=self.main_section, source_value=self.main_section,
...@@ -3348,7 +3348,7 @@ class TestTransactions(AccountingTestCase): ...@@ -3348,7 +3348,7 @@ class TestTransactions(AccountingTestCase):
def test_Organisation_getMappingRelatedOrganisation(self): def test_Organisation_getMappingRelatedOrganisation(self):
# the main section needs an accounting period to be treated as mapping # the main section needs an accounting period to be treated as mapping
# related by Organisation_getMappingRelatedOrganisation # related by Organisation_getMappingRelatedOrganisation
section_period_2001 = self.main_section.newContent( self.main_section.newContent(
portal_type='Accounting Period', portal_type='Accounting Period',
short_title='code-2001', short_title='code-2001',
start_date=DateTime(2001, 1, 1), start_date=DateTime(2001, 1, 1),
...@@ -3520,7 +3520,7 @@ class TestTransactions(AccountingTestCase): ...@@ -3520,7 +3520,7 @@ class TestTransactions(AccountingTestCase):
source_debit=100), source_debit=100),
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=100),)) source_credit=100),))
accounting_transaction = self._makeOne( self._makeOne(
destination_section_value=self.organisation_module.client_1, destination_section_value=self.organisation_module.client_1,
causality_value=invoice, causality_value=invoice,
lines=(dict(source_value=self.account_module.goods_purchase, lines=(dict(source_value=self.account_module.goods_purchase,
...@@ -3607,7 +3607,7 @@ class TestTransactions(AccountingTestCase): ...@@ -3607,7 +3607,7 @@ class TestTransactions(AccountingTestCase):
for portal_type in accounting_module.getVisibleAllowedContentTypeList(): for portal_type in accounting_module.getVisibleAllowedContentTypeList():
accounting_transaction = accounting_module.newContent( accounting_transaction = accounting_module.newContent(
portal_type=portal_type) portal_type=portal_type)
line = accounting_transaction.newContent( accounting_transaction.newContent(
id = 'line_with_grouping_reference', id = 'line_with_grouping_reference',
grouping_reference='A', grouping_reference='A',
grouping_date=DateTime(), grouping_date=DateTime(),
...@@ -3727,7 +3727,6 @@ class TestTransactions(AccountingTestCase): ...@@ -3727,7 +3727,6 @@ class TestTransactions(AccountingTestCase):
source_debit=100), source_debit=100),
dict(source_value=self.account_module.bank, dict(source_value=self.account_module.bank,
source_credit=100,))) source_credit=100,)))
payment_line = payment.line_with_grouping_reference
self.tic() self.tic()
invoice.cancel() invoice.cancel()
invoice.manage_delObjects([line.getId() for line in invoice.contentValues()]) invoice.manage_delObjects([line.getId() for line in invoice.contentValues()])
...@@ -3799,7 +3798,7 @@ class TestTransactions(AccountingTestCase): ...@@ -3799,7 +3798,7 @@ class TestTransactions(AccountingTestCase):
# the main section needs an accounting period to be treated as mapping # the main section needs an accounting period to be treated as mapping
# related by Organisation_getMappingRelatedOrganisation # related by Organisation_getMappingRelatedOrganisation
section_period_2001 = self.main_section.newContent( self.main_section.newContent(
portal_type='Accounting Period', portal_type='Accounting Period',
short_title='code-2001', short_title='code-2001',
start_date=DateTime(2001, 1, 1), start_date=DateTime(2001, 1, 1),
...@@ -4054,7 +4053,6 @@ class TestTransactions(AccountingTestCase): ...@@ -4054,7 +4053,6 @@ class TestTransactions(AccountingTestCase):
source_debit=100.032345), source_debit=100.032345),
dict(source_value=self.account_module.receivable, dict(source_value=self.account_module.receivable,
source_credit=100.000001))) source_credit=100.000001)))
precision = invoice.getQuantityPrecisionFromResource(invoice.getResource())
invoice.newContent(portal_type='Invoice Line', quantity=1, price=100) invoice.newContent(portal_type='Invoice Line', quantity=1, price=100)
self.assertRaises(invoice.AccountingTransaction_roundDebitCredit) self.assertRaises(invoice.AccountingTransaction_roundDebitCredit)
...@@ -4940,10 +4938,10 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -4940,10 +4938,10 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
created_by_builder = 0, created_by_builder = 0,
) )
line = invoice.newContent( invoice.newContent(
portal_type = self.sale_invoice_transaction_line_portal_type, portal_type = self.sale_invoice_transaction_line_portal_type,
quantity = 100, source_value = sequence.get('account_list')[0]) quantity = 100, source_value = sequence.get('account_list')[0])
line = invoice.newContent( invoice.newContent(
portal_type = self.sale_invoice_transaction_line_portal_type, portal_type = self.sale_invoice_transaction_line_portal_type,
quantity = -100, source_value = sequence.get('account_list')[1]) quantity = -100, source_value = sequence.get('account_list')[1])
sequence.edit(invoice_list = [invoice]) sequence.edit(invoice_list = [invoice])
...@@ -5113,7 +5111,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -5113,7 +5111,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
def createAccountingTransaction(self, def createAccountingTransaction(self,
portal_type=accounting_transaction_portal_type, portal_type=accounting_transaction_portal_type,
line_portal_type=accounting_transaction_line_portal_type, line_portal_type=accounting_transaction_line_portal_type,
quantity=100, reindex=1, check_consistency=1, **kw): quantity=100, reindex=1, check_consistency=1, **kw): # pylint: disable=redefined-outer-name
"""Creates an accounting transaction. """Creates an accounting transaction.
By default, this transaction contains 2 lines, income and receivable. By default, this transaction contains 2 lines, income and receivable.
quantity - The quantity property on created lines. quantity - The quantity property on created lines.
...@@ -5272,7 +5270,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -5272,7 +5270,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action')
self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') self.assertEqual(accounting_transaction.getSimulationState(), 'stopped')
except ValidationFailed as err: except ValidationFailed as err:
self.assert_(0, "Validation failed : %s" % err.msg) raise AssertionError("Validation failed : %s" % err.msg)
# if we do not use any payable / receivable account, then we can # if we do not use any payable / receivable account, then we can
# validate the transaction without setting the mirror section. # validate the transaction without setting the mirror section.
...@@ -5294,13 +5292,12 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -5294,13 +5292,12 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action')
self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') self.assertEqual(accounting_transaction.getSimulationState(), 'stopped')
except ValidationFailed as err: except ValidationFailed as err:
self.assert_(0, "Validation failed : %s" % err.msg) raise AssertionError("Validation failed : %s" % err.msg)
def stepValidateNoCurrency(self, sequence, sequence_list=None, **kw) : def stepValidateNoCurrency(self, sequence, sequence_list=None, **kw) :
"""Check validation behaviour related to currency. """Check validation behaviour related to currency.
""" """
accounting_transaction = sequence.get('transaction') accounting_transaction = sequence.get('transaction')
old_resource = accounting_transaction.getResource()
accounting_transaction.setResource(None) accounting_transaction.setResource(None)
self.assertRaises(ValidationFailed, self.assertRaises(ValidationFailed,
self.getWorkflowTool().doActionFor, self.getWorkflowTool().doActionFor,
...@@ -5368,7 +5365,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -5368,7 +5365,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
# 0 quantity, but a destination asset price => do not delete the # 0 quantity, but a destination asset price => do not delete the
# line # line
accounting_transaction = self.createAccountingTransaction() accounting_transaction = self.createAccountingTransaction()
new_line = accounting_transaction.newContent( accounting_transaction.newContent(
portal_type = self.accounting_transaction_line_portal_type) portal_type = self.accounting_transaction_line_portal_type)
self.assertEqual(len(accounting_transaction.getMovementList()), 3) self.assertEqual(len(accounting_transaction.getMovementList()), 3)
line_list = accounting_transaction.getMovementList() line_list = accounting_transaction.getMovementList()
...@@ -5385,7 +5382,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -5385,7 +5382,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action')
self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') self.assertEqual(accounting_transaction.getSimulationState(), 'stopped')
except ValidationFailed as err: except ValidationFailed as err:
self.assert_(0, "Validation failed : %s" % err.msg) raise AssertionError("Validation failed : %s" % err.msg)
def stepValidateNotBalanced(self, sequence, sequence_list=None, **kw) : def stepValidateNotBalanced(self, sequence, sequence_list=None, **kw) :
"""Check validation behaviour when transaction is not balanced. """Check validation behaviour when transaction is not balanced.
...@@ -5430,7 +5427,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -5430,7 +5427,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action') self.getWorkflowTool().doActionFor(accounting_transaction, 'stop_action')
self.assertEqual(accounting_transaction.getSimulationState(), 'stopped') self.assertEqual(accounting_transaction.getSimulationState(), 'stopped')
except ValidationFailed as err: except ValidationFailed as err:
self.assert_(0, "Validation failed : %s" % err.msg) raise AssertionError("Validation failed : %s" % err.msg)
def stepValidateNoPayment(self, sequence, sequence_list=None, **kw) : def stepValidateNoPayment(self, sequence, sequence_list=None, **kw) :
"""Check validation behaviour related to payment & mirror_payment. """Check validation behaviour related to payment & mirror_payment.
...@@ -5519,7 +5516,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase): ...@@ -5519,7 +5516,7 @@ class TestAccountingWithSequences(ERP5TypeTestCase):
source_section=accounting_transaction.getSourceSection(), source_section=accounting_transaction.getSourceSection(),
destination_section=accounting_transaction.getDestinationSection(), destination_section=accounting_transaction.getDestinationSection(),
created_by_builder=1) created_by_builder=1)
for i in range(3): for _ in range(3):
another_accounting_transaction.newContent( another_accounting_transaction.newContent(
portal_type=self.accounting_transaction_line_portal_type) portal_type=self.accounting_transaction_line_portal_type)
lines_count = len(another_accounting_transaction.getMovementList()) lines_count = len(another_accounting_transaction.getMovementList())
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testAccounting</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testAccounting</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testAccounting</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -33,7 +33,7 @@ import unittest ...@@ -33,7 +33,7 @@ import unittest
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5.tests.testAccounting import AccountingTestCase from erp5.component.test.testAccounting import AccountingTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
...@@ -523,7 +523,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -523,7 +523,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
node_title='7', node_title='7',
debit=0, debit=0,
credit=500) credit=500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit=500, credit=500) self.checkLineProperties(line_list[-1], debit=500, credit=500)
...@@ -556,7 +555,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -556,7 +555,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
node_title='7', node_title='7',
debit=0, debit=0,
credit=500) credit=500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit=500, credit=500) self.checkLineProperties(line_list[-1], debit=500, credit=500)
...@@ -1100,7 +1098,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1100,7 +1098,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.stocks, dict(source_value=account_module.stocks,
source_credit=100))) source_credit=100)))
first = self._makeOne( self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Grouped during period', title='Grouped during period',
simulation_state='delivered', simulation_state='delivered',
...@@ -1116,7 +1114,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1116,7 +1114,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.goods_sales, dict(source_value=account_module.goods_sales,
source_credit=100.00))) source_credit=100.00)))
second = self._makeOne( self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Grouped after period', title='Grouped after period',
simulation_state='delivered', simulation_state='delivered',
...@@ -1251,7 +1249,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1251,7 +1249,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
bank.validate() bank.validate()
# before # before
# this one will not have grouping reference # this one will not have grouping reference
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
reference='ref1', reference='ref1',
...@@ -1278,7 +1276,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1278,7 +1276,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_credit=200.0))) source_credit=200.0)))
# payment related to t2 invoice # payment related to t2 invoice
t3 = self._makeOne( self._makeOne(
portal_type='Payment Transaction', portal_type='Payment Transaction',
title='Transaction 3', title='Transaction 3',
reference='ref3', reference='ref3',
...@@ -1311,7 +1309,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1311,7 +1309,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_debit=400.0), source_debit=400.0),
dict(source_value=account_module.payable, dict(source_value=account_module.payable,
source_credit=400.0))) source_credit=400.0)))
t5 = self._makeOne( self._makeOne(
portal_type='Payment Transaction', portal_type='Payment Transaction',
title='Transaction 5', title='Transaction 5',
reference='ref5', reference='ref5',
...@@ -1407,7 +1405,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1407,7 +1405,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
bank.validate() bank.validate()
# before # before
# this one will not have grouping reference # this one will not have grouping reference
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
reference='ref1', reference='ref1',
...@@ -1436,7 +1434,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1436,7 +1434,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_credit=200.0))) source_credit=200.0)))
# payment related to t2 invoice # payment related to t2 invoice
t3 = self._makeOne( self._makeOne(
portal_type='Payment Transaction', portal_type='Payment Transaction',
title='Transaction 3', title='Transaction 3',
reference='ref3', reference='ref3',
...@@ -1724,7 +1722,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1724,7 +1722,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.createAccountStatementDataSetOnTwoPeriods() self.createAccountStatementDataSetOnTwoPeriods()
t1b = self._makeOne( self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 1b', title='Transaction 1b',
reference='ref1b', reference='ref1b',
...@@ -1789,7 +1787,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1789,7 +1787,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
self.createAccountStatementDataSetOnTwoPeriods() self.createAccountStatementDataSetOnTwoPeriods()
t1b = self._makeOne( self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Transaction 1b', title='Transaction 1b',
reference='ref1b', reference='ref1b',
...@@ -1974,7 +1972,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -1974,7 +1972,6 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
data_line_list = [l for l in line_list if l.isDataLine()] data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEqual(1, len(data_line_list)) self.assertEqual(1, len(data_line_list))
line = data_line_list[0]
self.checkLineProperties(data_line_list[0], self.checkLineProperties(data_line_list[0],
Movement_getSpecificReference='4', Movement_getSpecificReference='4',
date=DateTime(2006, 2, 2, 0, 3), date=DateTime(2006, 2, 2, 0, 3),
...@@ -2025,7 +2022,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2025,7 +2022,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
def testAccountStatementCancellationAmount(self): def testAccountStatementCancellationAmount(self):
# Account statement with cancellation amount set on lines # Account statement with cancellation amount set on lines
account_module = self.account_module account_module = self.account_module
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
source_reference='1', source_reference='1',
...@@ -2038,7 +2035,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2038,7 +2035,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
source_debit=-100.0, source_debit=-100.0,
cancellation_amount=True))) cancellation_amount=True)))
t2 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 2', title='Transaction 2',
source_reference='2', source_reference='2',
...@@ -2092,7 +2089,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2092,7 +2089,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
def testAccountStatementSameSectionSameNode(self): def testAccountStatementSameSectionSameNode(self):
# Account statement with a movement on the same section and the same node # Account statement with a movement on the same section and the same node
account_module = self.account_module account_module = self.account_module
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
source_reference='Source Reference', source_reference='Source Reference',
...@@ -2155,7 +2152,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2155,7 +2152,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# When there are multiple sections for the same group, an extra column # When there are multiple sections for the same group, an extra column
# is added for the section # is added for the section
account_module = self.portal.account_module account_module = self.portal.account_module
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
reference='ref1', reference='ref1',
...@@ -2168,7 +2165,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2168,7 +2165,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.payable, dict(source_value=account_module.payable,
source_credit=100.0))) source_credit=100.0)))
t2 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 2', title='Transaction 2',
reference='ref2', reference='ref2',
...@@ -2510,7 +2507,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2510,7 +2507,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
def testTrialBalanceMultipleSection(self): def testTrialBalanceMultipleSection(self):
account_module = self.portal.account_module account_module = self.portal.account_module
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
source_reference='1', source_reference='1',
...@@ -2522,7 +2519,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -2522,7 +2519,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.payable, dict(source_value=account_module.payable,
source_credit=100.0))) source_credit=100.0)))
t2 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 2', title='Transaction 2',
source_reference='2', source_reference='2',
...@@ -3602,10 +3599,8 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -3602,10 +3599,8 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
request_form['function'] = '' request_form['function'] = ''
request_form['group_analytic'] = ["function"] request_form['group_analytic'] = ["function"]
request_form['show_detailed_balance_columns'] = 1 request_form['show_detailed_balance_columns'] = 1
report_section_list = self.portal.accounting_module.AccountModule_getTrialBalanceReportSectionList()
line_list = self.getListBoxLineList(report_section_list[0])
# XXX where is the end of this test ? # XXX where is the end of this test ?
#report_section_list = self.portal.accounting_module.AccountModule_getTrialBalanceReportSectionList()
def testTrialBalanceProject(self): def testTrialBalanceProject(self):
# trial balance restricted to a project # trial balance restricted to a project
...@@ -4583,7 +4578,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -4583,7 +4578,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
def testOtherPartiesReport(self): def testOtherPartiesReport(self):
# Other parties report # Other parties report
account_module = self.portal.account_module account_module = self.portal.account_module
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
source_reference='1', source_reference='1',
...@@ -4595,7 +4590,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -4595,7 +4590,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.goods_sales, dict(source_value=account_module.goods_sales,
source_credit=100.0))) source_credit=100.0)))
t2 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 2', title='Transaction 2',
source_reference='2', source_reference='2',
...@@ -4661,7 +4656,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -4661,7 +4656,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
# entities belong to the same ledger # entities belong to the same ledger
self.createLedgerCategory() self.createLedgerCategory()
account_module = self.portal.account_module account_module = self.portal.account_module
t1 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 1', title='Transaction 1',
source_reference='1', source_reference='1',
...@@ -4674,7 +4669,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -4674,7 +4669,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.goods_sales, dict(source_value=account_module.goods_sales,
source_credit=100.0))) source_credit=100.0)))
t2 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 2', title='Transaction 2',
source_reference='2', source_reference='2',
...@@ -4687,7 +4682,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -4687,7 +4682,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
dict(source_value=account_module.goods_sales, dict(source_value=account_module.goods_sales,
source_credit=200.0))) source_credit=200.0)))
t3 = self._makeOne( self._makeOne(
portal_type='Accounting Transaction', portal_type='Accounting Transaction',
title='Transaction 3', title='Transaction 3',
source_reference='3', source_reference='3',
...@@ -5074,7 +5069,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase): ...@@ -5074,7 +5069,7 @@ class TestAccountingReports(AccountingTestCase, ERP5ReportTestCase):
portal_type='Organisation', portal_type='Organisation',
title='ZZZ Supplier' title='ZZZ Supplier'
) )
purchase2 = self._makeOne( self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
title='Purchase invoice 0', title='Purchase invoice 0',
destination_reference='0', destination_reference='0',
...@@ -5261,7 +5256,6 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): ...@@ -5261,7 +5256,6 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
debit=0, debit=0,
credit=700) credit=700)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit=1500, credit=1500) self.checkLineProperties(line_list[-1], debit=1500, credit=1500)
...@@ -5299,7 +5293,6 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase): ...@@ -5299,7 +5293,6 @@ class TestAccountingReportsWithAnalytic(AccountingTestCase, ERP5ReportTestCase):
node_title='7', node_title='7',
debit=0, debit=0,
credit=1500) credit=1500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit=1500, credit=1500) self.checkLineProperties(line_list[-1], debit=1500, credit=1500)
...@@ -5345,7 +5338,6 @@ DT, b, P2 - Project 2''', ...@@ -5345,7 +5338,6 @@ DT, b, P2 - Project 2''',
credit_price=700, credit_price=700,
running_total_price=-1500) running_total_price=-1500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500)
...@@ -5374,7 +5366,6 @@ DT, b, P2 - Project 2''', ...@@ -5374,7 +5366,6 @@ DT, b, P2 - Project 2''',
credit_price=1500, credit_price=1500,
running_total_price=-1500) running_total_price=-1500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500)
...@@ -5493,7 +5484,6 @@ DT, b, P2 - Project 2''', ...@@ -5493,7 +5484,6 @@ DT, b, P2 - Project 2''',
getTranslatedSimulationStateTitle='Closed') getTranslatedSimulationStateTitle='Closed')
# There is no stat line in export # There is no stat line in export
stat_line = line_list[-1]
self.assertFalse(line_list[-1].isStatLine()) self.assertFalse(line_list[-1].isStatLine())
def testGeneralLedgerAnalyticsShown(self): def testGeneralLedgerAnalyticsShown(self):
...@@ -5543,7 +5533,6 @@ DT, b, P2 - Project 2''', ...@@ -5543,7 +5533,6 @@ DT, b, P2 - Project 2''',
credit_price=700, credit_price=700,
running_total_price=-1500) running_total_price=-1500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500)
...@@ -5583,7 +5572,6 @@ DT, b, P2 - Project 2''', ...@@ -5583,7 +5572,6 @@ DT, b, P2 - Project 2''',
debit_price=1500, debit_price=1500,
credit_price=0, credit_price=0,
running_total_price=1500) running_total_price=1500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=1500, credit_price=0) self.checkLineProperties(line_list[-1], debit_price=1500, credit_price=0)
# good sales account # good sales account
...@@ -5594,7 +5582,6 @@ DT, b, P2 - Project 2''', ...@@ -5594,7 +5582,6 @@ DT, b, P2 - Project 2''',
debit_price=0, debit_price=0,
credit_price=1500, credit_price=1500,
running_total_price=-1500) running_total_price=-1500)
stat_line = line_list[-1]
self.assertTrue(line_list[-1].isStatLine()) self.assertTrue(line_list[-1].isStatLine())
self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500) self.checkLineProperties(line_list[-1], debit_price=0, credit_price=1500)
# summary # summary
...@@ -5763,7 +5750,6 @@ DT, b, P2 - Project 2''', ...@@ -5763,7 +5750,6 @@ DT, b, P2 - Project 2''',
grouping_date=None, grouping_date=None,
getTranslatedSimulationStateTitle='Closed') getTranslatedSimulationStateTitle='Closed')
stat_line = line_list[-1]
# There is no stat in export mode # There is no stat in export mode
self.assertFalse(line_list[-1].isStatLine()) self.assertFalse(line_list[-1].isStatLine())
# There is not stat section either # There is not stat section either
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testAccountingReports</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testAccountingReports</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testAccountingReports</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
##############################################################################
# Copyright (c) 2016 Nexedi SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
class PortalTypeOfPortalTypeTestCase(ERP5TypeTestCase):
"""
Base class to test Portal Types of other Portal Types
"""
def getBusinessTemplateList(self):
return ('erp5_core', 'erp5_base', 'erp5_simulation', 'erp5_accounting')
def setUpPropertyOnPortalType(self, portal_type_id, property_name, property_value):
portal_type = self.portal.portal_types.get(portal_type_id, None)
portal_type.setProperty(property_name, property_value)
def cleanPropertyOnPortalType(self, portal_type_id, property_name):
portal_type = self.portal.portal_types.get(portal_type_id, None)
portal_type.setProperty(property_name, None)
class TestDeliveryTypeInformation(PortalTypeOfPortalTypeTestCase):
"""
Delivery Type is a Base Type on which a list of allowed ledgers is defined.
This suite checks that its custom features are correctly implemented.
"""
def afterSetUp(self):
self.createLedgerCategory()
@UnrestrictedMethod
def createLedgerCategory(self):
portal_categories = self.portal.portal_categories
ledger = self.portal.portal_categories.get('ledger', None)
if ledger is None:
ledger = portal_categories.newContent(portal_type='Base Category',
id='ledger')
accounting_ledger = ledger.get('accounting', None)
if accounting_ledger is None:
accounting_ledger = ledger.newContent(portal_type='Category',
id='accounting')
if accounting_ledger.get('general', None) is None:
accounting_ledger.newContent(portal_type='Category', id='general')
if accounting_ledger.get('detailed', None) is None:
accounting_ledger.newContent(portal_type='Category', id='detailed')
def testDefaultLedgerIsSetOnObjectIfSetOnPortalType(self):
"""
Sets up a list of ledger on the Accounting Transaction portal type,
which is a DeliveryTypeInformation, and checks that new Accounting Transactions
have a default ledger set at their creation
"""
portal_type = "Accounting Transaction"
self.setUpPropertyOnPortalType(
portal_type,
"ledger_list",
['accounting/general', 'accounting/detailed'])
self.assertEqual(self.portal.portal_types.get(portal_type).getDefaultLedger(),
'accounting/general')
module = self.portal.getDefaultModule(portal_type)
accounting_transaction = module.newContent(portal_type=portal_type)
self.assertEqual(accounting_transaction.hasLedger(), True)
self.assertEqual(accounting_transaction.getLedgerList(),
['accounting/general'])
def testDefaultLedgerIsNotSetOnObjectIfNotSetOnPortalType(self):
"""
If no ledger is defined on the portal type, then it means the
"allowed ledger list" feature is not in use in this instance
"""
portal_type = "Accounting Transaction"
portal_type_object = self.portal.portal_types.get(portal_type)
self.cleanPropertyOnPortalType(portal_type, 'ledger')
# No ledger should be set on the portal type
self.assertEqual(portal_type_object.getLedgerList(), [])
module = self.portal.getDefaultModule(portal_type)
accounting_transaction = module.newContent(portal_type=portal_type)
self.assertEqual(accounting_transaction.getLedgerList(), [])
def testDefaultLedgerIsOverwrittenByNewContentParameter(self):
"""
If a Delivery is created with a given ledger, then it should overwrite
the default ledger
"""
portal_type = "Accounting Transaction"
self.setUpPropertyOnPortalType(
portal_type,
"ledger_list",
['accounting/general', 'accounting/detailed'])
self.assertEqual(self.portal.portal_types.get(portal_type).getDefaultLedger(),
'accounting/general')
module = self.portal.getDefaultModule(portal_type)
accounting_transaction = module.newContent(portal_type=portal_type,
ledger='accounting/detailed')
self.assertEqual(accounting_transaction.hasLedger(), True)
self.assertEqual(accounting_transaction.getLedgerList(),
['accounting/detailed'])
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTypeDefinition</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.tests.testTypeDefinition</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTypeDefinition</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testAccounting
test.erp5.testAccountingReports
test.erp5.testTypeDefinition
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_core_proxy_field_legacy
erp5_base
erp5_pdm
erp5_simulation
erp5_trade
erp5_project
erp5_ods_style
erp5_configurator_standard_trade_template
erp5_invoicing
erp5_configurator_standard_accounting_template
erp5_configurator_standard_invoicing_template
erp5_simulation_test
erp5_accounting_ui_test
erp5_simplified_invoicing
\ No newline at end of file
...@@ -40,7 +40,7 @@ from DateTime import DateTime ...@@ -40,7 +40,7 @@ from DateTime import DateTime
from lxml import etree from lxml import etree
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5.tests.testAccounting import AccountingTestCase from erp5.component.test.testAccounting import AccountingTestCase
class TestAccounting_l10n_fr(AccountingTestCase): class TestAccounting_l10n_fr(AccountingTestCase):
"""Test Accounting L10N FR """Test Accounting L10N FR
...@@ -92,7 +92,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -92,7 +92,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
def test_FEC(self): def test_FEC(self):
account_module = self.portal.account_module account_module = self.portal.account_module
first = self._makeOne( self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
title='Première Écriture', title='Première Écriture',
simulation_state='delivered', simulation_state='delivered',
...@@ -106,7 +106,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -106,7 +106,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
dict(destination_value=account_module.goods_purchase, dict(destination_value=account_module.goods_purchase,
destination_credit=110.00))) destination_credit=110.00)))
second = self._makeOne( self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Seconde Écriture', title='Seconde Écriture',
simulation_state='delivered', simulation_state='delivered',
...@@ -130,7 +130,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -130,7 +130,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
fec_xml = '' fec_xml = ''
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEquals((), last_message)
mfrom, mto, message_text = last_message _, mto, message_text = last_message
self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0]) self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0])
mail_message = email.message_from_string(message_text) mail_message = email.message_from_string(message_text)
for part in mail_message.walk(): for part in mail_message.walk():
...@@ -146,8 +146,9 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -146,8 +146,9 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.fail("Attachment not found") self.fail("Attachment not found")
# validate against official schema # validate against official schema
import Products.ERP5.tests
schema = etree.XMLSchema(etree.XML(open(os.path.join( schema = etree.XMLSchema(etree.XML(open(os.path.join(
os.path.dirname(__file__), 'test_data', os.path.dirname(Products.ERP5.tests.__file__), 'test_data',
'formatA47A-I-VII-1.xsd')).read())) 'formatA47A-I-VII-1.xsd')).read()))
# this raise if invalid # this raise if invalid
...@@ -164,7 +165,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -164,7 +165,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
def _FECWithLedger(self, ledger_list=None, group_by=None): def _FECWithLedger(self, ledger_list=None, group_by=None):
self.setUpLedger() self.setUpLedger()
account_module = self.portal.account_module account_module = self.portal.account_module
first = self._makeOne( self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
title='Première Écriture', title='Première Écriture',
simulation_state='delivered', simulation_state='delivered',
...@@ -179,7 +180,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -179,7 +180,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
dict(destination_value=account_module.goods_purchase, dict(destination_value=account_module.goods_purchase,
destination_credit=110.00))) destination_credit=110.00)))
second = self._makeOne( self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Seconde Écriture', title='Seconde Écriture',
simulation_state='delivered', simulation_state='delivered',
...@@ -194,7 +195,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -194,7 +195,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
dict(source_value=account_module.goods_sales, dict(source_value=account_module.goods_sales,
source_credit=200.00))) source_credit=200.00)))
third = self._makeOne( self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
title='Troisième Écriture', title='Troisième Écriture',
simulation_state='delivered', simulation_state='delivered',
...@@ -222,7 +223,7 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -222,7 +223,7 @@ class TestAccounting_l10n_fr(AccountingTestCase):
fec_xml = '' fec_xml = ''
last_message = self.portal.MailHost._last_message last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message) self.assertNotEquals((), last_message)
mfrom, mto, message_text = last_message _, mto, message_text = last_message
self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0]) self.assertEqual('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0])
mail_message = email.message_from_string(message_text) mail_message = email.message_from_string(message_text)
for part in mail_message.walk(): for part in mail_message.walk():
...@@ -238,8 +239,9 @@ class TestAccounting_l10n_fr(AccountingTestCase): ...@@ -238,8 +239,9 @@ class TestAccounting_l10n_fr(AccountingTestCase):
self.fail("Attachment not found") self.fail("Attachment not found")
# validate against official schema # validate against official schema
import Products.ERP5.tests
schema = etree.XMLSchema(etree.XML(open(os.path.join( schema = etree.XMLSchema(etree.XML(open(os.path.join(
os.path.dirname(__file__), 'test_data', os.path.dirname(Products.ERP5.tests.__file__), 'test_data',
'formatA47A-I-VII-1.xsd')).read())) 'formatA47A-I-VII-1.xsd')).read()))
# this raise if invalid # this raise if invalid
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testAccounting_l10n_fr</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testAccounting_l10n_fr</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testAccounting_l10n_fr</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testAccounting_l10n_fr
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_core_proxy_field_legacy
erp5_base
erp5_pdm
erp5_simulation
erp5_trade
erp5_project
erp5_ods_style
erp5_configurator_standard_trade_template
erp5_invoicing
erp5_configurator_standard_accounting_template
erp5_configurator_standard_invoicing_template
erp5_simulation_test
erp5_accounting_ui_test
erp5_deferred_style
\ No newline at end of file
...@@ -31,7 +31,7 @@ import unittest ...@@ -31,7 +31,7 @@ import unittest
from DateTime import DateTime from DateTime import DateTime
from zLOG import LOG from zLOG import LOG
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5.tests.testAccounting import AccountingTestCase from erp5.component.test.testAccounting import AccountingTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
QUIET = False QUIET = False
run_all_test = True run_all_test = True
...@@ -80,11 +80,11 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -80,11 +80,11 @@ class TestConversionInSimulation(AccountingTestCase):
def createCategoriesInCategory(self, category, category_id_list): def createCategoriesInCategory(self, category, category_id_list):
for category_id in category_id_list: for category_id in category_id_list:
child = category child = category
for id in category_id.split('/'): for id_ in category_id.split('/'):
try: try:
child = child[id] child = child[id_]
except KeyError: except KeyError:
child = child.newContent(id) child = child.newContent(id_)
def createCategories(self): def createCategories(self):
"""Create the categories for our test. """ """Create the categories for our test. """
...@@ -101,16 +101,16 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -101,16 +101,16 @@ class TestConversionInSimulation(AccountingTestCase):
['accounting', 'delivery', 'invoicing', 'discount', 'tax', 'payment']) ['accounting', 'delivery', 'invoicing', 'discount', 'tax', 'payment'])
_(category_tool.product_line, ['apparel']) _(category_tool.product_line, ['apparel'])
def _solveDivergence(self, obj, property, decision, group='line'): def _solveDivergence(self, obj, prop, decision, group='line'):
""" """
Check if simulation movement are disconnected Check if simulation movement are disconnected
""" """
kw = {'%s_group_listbox' % group:{}} kw = {'%s_group_listbox' % group:{}}
for divergence in obj.getDivergenceList(): for divergence in obj.getDivergenceList():
if divergence.getProperty('tested_property') != property: if divergence.getProperty('tested_property') != prop:
continue continue
sm_url = divergence.getProperty('simulation_movement').getRelativeUrl() sm_url = divergence.getProperty('simulation_movement').getRelativeUrl()
kw['line_group_listbox']['%s&%s' % (sm_url, property)] = { kw['line_group_listbox']['%s&%s' % (sm_url, prop)] = {
'choice':decision} 'choice':decision}
self.portal.portal_workflow.doActionFor( self.portal.portal_workflow.doActionFor(
obj, obj,
...@@ -144,7 +144,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -144,7 +144,7 @@ class TestConversionInSimulation(AccountingTestCase):
self.tic() self.tic()
super(TestConversionInSimulation, self).beforeTearDown() super(TestConversionInSimulation, self).beforeTearDown()
def login(self,name=username, quiet=0, run=run_all_test): def login(self, *args, **kw):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser(self.username, '', ['Assignee', 'Assignor', uf._doAddUser(self.username, '', ['Assignee', 'Assignor',
'Author'], []) 'Author'], [])
...@@ -247,7 +247,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -247,7 +247,7 @@ class TestConversionInSimulation(AccountingTestCase):
""" """
if not run: return if not run: return
if not quiet: if not quiet:
printAndLog('test_01_simulation_movement_destination_asset_price') printAndLog('test_01_simulation_movement_destination_asset_price')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
...@@ -291,10 +291,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -291,10 +291,10 @@ class TestConversionInSimulation(AccountingTestCase):
price_currency_value=currency, price_currency_value=currency,
specialise_value=self.business_process, specialise_value=self.business_process,
title='Order') title='Order')
order_line = order.newContent(portal_type='Sale Order Line', order.newContent(portal_type='Sale Order Line',
resource_value=resource, resource_value=resource,
quantity=1, quantity=1,
price=2) price=2)
order.confirm() order.confirm()
self.tic() self.tic()
...@@ -339,7 +339,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -339,7 +339,7 @@ class TestConversionInSimulation(AccountingTestCase):
""" """
if not run: return if not run: return
if not quiet: if not quiet:
printAndLog('test_01_simulation_movement_source_asset_price') printAndLog('test_01_simulation_movement_source_asset_price')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
portal_type='Product', portal_type='Product',
title='Resource', title='Resource',
...@@ -383,10 +383,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -383,10 +383,10 @@ class TestConversionInSimulation(AccountingTestCase):
price_currency_value=currency, price_currency_value=currency,
specialise_value=self.business_process, specialise_value=self.business_process,
title='Order') title='Order')
order_line = order.newContent(portal_type='Sale Order Line', order.newContent(portal_type='Sale Order Line',
resource_value=resource, resource_value=resource,
quantity=1, quantity=1,
price=2) price=2)
order.confirm() order.confirm()
self.tic() self.tic()
...@@ -421,7 +421,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -421,7 +421,7 @@ class TestConversionInSimulation(AccountingTestCase):
""" """
if not run: return if not run: return
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_destination_total_asset_price_on_accounting_lines') 'test_01_destination_total_asset_price_on_accounting_lines')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
...@@ -467,10 +467,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -467,10 +467,10 @@ class TestConversionInSimulation(AccountingTestCase):
price_currency_value=currency, price_currency_value=currency,
specialise_value=self.business_process, specialise_value=self.business_process,
title='Order') title='Order')
order_line = order.newContent(portal_type='Sale Order Line', order.newContent(portal_type='Sale Order Line',
resource_value=resource, resource_value=resource,
quantity=1, quantity=1,
price=2) price=2)
order.confirm() order.confirm()
self.tic() self.tic()
self.buildPackingLists() self.buildPackingLists()
...@@ -495,7 +495,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -495,7 +495,7 @@ class TestConversionInSimulation(AccountingTestCase):
portal_type=self.portal.getPortalAccountingMovementTypeList()) portal_type=self.portal.getPortalAccountingMovementTypeList())
self.assertNotEquals(line_list, None) self.assertNotEquals(line_list, None)
for line in line_list: for line in line_list:
self.assertEqual(line.getDestinationTotalAssetPrice(), self.assertEqual(line.getDestinationTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice())) round(655.957*delivery_movement.getTotalPrice()))
def test_01_diverged_sale_packing_list_destination_total_asset_price( def test_01_diverged_sale_packing_list_destination_total_asset_price(
...@@ -509,7 +509,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -509,7 +509,7 @@ class TestConversionInSimulation(AccountingTestCase):
""" """
if not run: return if not run: return
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_diverged_sale_packing_list_destination_total_asset_price') 'test_01_diverged_sale_packing_list_destination_total_asset_price')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
...@@ -555,10 +555,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -555,10 +555,10 @@ class TestConversionInSimulation(AccountingTestCase):
price_currency_value=currency, price_currency_value=currency,
specialise_value=self.business_process, specialise_value=self.business_process,
title='Order') title='Order')
order_line = order.newContent(portal_type='Sale Order Line', order.newContent(portal_type='Sale Order Line',
resource_value=resource, resource_value=resource,
quantity=5, quantity=5,
price=2) price=2)
order.confirm() order.confirm()
self.tic() self.tic()
self.buildPackingLists() self.buildPackingLists()
...@@ -608,7 +608,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -608,7 +608,7 @@ class TestConversionInSimulation(AccountingTestCase):
""" """
if not run: return if not run: return
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_diverged_purchase_packing_list_source_total_asset_price') 'test_01_diverged_purchase_packing_list_source_total_asset_price')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
...@@ -654,10 +654,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -654,10 +654,10 @@ class TestConversionInSimulation(AccountingTestCase):
price_currency_value=currency, price_currency_value=currency,
specialise_value=self.business_process, specialise_value=self.business_process,
title='Order') title='Order')
order_line = order.newContent(portal_type='Purchase Order Line', order.newContent(portal_type='Purchase Order Line',
resource_value=resource, resource_value=resource,
quantity=5, quantity=5,
price=2) price=2)
order.confirm() order.confirm()
self.tic() self.tic()
self.buildPackingLists() self.buildPackingLists()
...@@ -707,7 +707,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -707,7 +707,7 @@ class TestConversionInSimulation(AccountingTestCase):
""" """
if not run: return if not run: return
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_delivery_mode_on_sale_packing_list_and_invoice') 'test_01_delivery_mode_on_sale_packing_list_and_invoice')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
...@@ -755,10 +755,10 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -755,10 +755,10 @@ class TestConversionInSimulation(AccountingTestCase):
incoterm=self.cpt_incoterm, incoterm=self.cpt_incoterm,
specialise_value=self.business_process, specialise_value=self.business_process,
title='Order') title='Order')
order_line = order.newContent(portal_type='Sale Order Line', order.newContent(portal_type='Sale Order Line',
resource_value=resource, resource_value=resource,
quantity=5, quantity=5,
price=2) price=2)
order.confirm() order.confirm()
self.tic() self.tic()
self.buildPackingLists() self.buildPackingLists()
...@@ -788,7 +788,7 @@ class TestConversionInSimulation(AccountingTestCase): ...@@ -788,7 +788,7 @@ class TestConversionInSimulation(AccountingTestCase):
""" """
if not run: return if not run: return
if not quiet: if not quiet:
printAndLog( printAndLog(
'test_01_quantity_unit_on_sale_packing_list') 'test_01_quantity_unit_on_sale_packing_list')
resource = self.portal.product_module.newContent( resource = self.portal.product_module.newContent(
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testConversionInSimulation</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testConversionInSimulation</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testConversionInSimulation</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
import unittest import unittest
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5.tests.testAccounting import AccountingTestCase from erp5.component.test.testAccounting import AccountingTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
class CurrencyExchangeTestCase(AccountingTestCase): class CurrencyExchangeTestCase(AccountingTestCase):
...@@ -56,7 +56,7 @@ class CurrencyExchangeTestCase(AccountingTestCase): ...@@ -56,7 +56,7 @@ class CurrencyExchangeTestCase(AccountingTestCase):
self.tic() self.tic()
def login(self, name=username): def login(self, *args, **kw):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser(self.username, '', ['Assignee', 'Assignor', uf._doAddUser(self.username, '', ['Assignee', 'Assignor',
'Author','Manager'], []) 'Author','Manager'], [])
...@@ -146,7 +146,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -146,7 +146,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
x_curr_ex_line.validate() x_curr_ex_line.validate()
self.assertEqual(x_curr_ex_line.getValidationState(), self.assertEqual(x_curr_ex_line.getValidationState(),
'validated') 'validated')
accounting_module = self.portal.accounting_module
invoice = self._makeOne( invoice = self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
stop_date=DateTime('2008/09/08'), stop_date=DateTime('2008/09/08'),
...@@ -195,21 +194,16 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -195,21 +194,16 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
self.assertEqual(x_curr_ex_line.getValidationState(), self.assertEqual(x_curr_ex_line.getValidationState(),
'validated') 'validated')
yen = self.portal.currency_module.yen yen = self.portal.currency_module.yen
yen_line1 = yen.newContent( yen.newContent(portal_type='Currency Exchange Line')
portal_type='Currency Exchange Line') yen.newContent(portal_type='Currency Exchange Line')
yen_line2 = yen.newContent(
portal_type='Currency Exchange Line')
usd = self.portal.currency_module.usd usd = self.portal.currency_module.usd
usd_line1 = usd.newContent( usd.newContent(portal_type='Currency Exchange Line')
portal_type='Currency Exchange Line') usd.newContent(portal_type='Currency Exchange Line')
usd_line2 = usd.newContent(
portal_type='Currency Exchange Line')
euro_line = euro.newContent( euro_line = euro.newContent(
portal_type='Currency Exchange Line') portal_type='Currency Exchange Line')
euro_line.validate() euro_line.validate()
accounting_module = self.portal.accounting_module
invoice = self._makeOne( invoice = self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
stop_date=DateTime('2008/09/08'), stop_date=DateTime('2008/09/08'),
...@@ -256,7 +250,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -256,7 +250,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
x_curr_ex_line.validate() x_curr_ex_line.validate()
self.assertEqual(x_curr_ex_line.getValidationState(), self.assertEqual(x_curr_ex_line.getValidationState(),
'validated') 'validated')
accounting_module = self.portal.accounting_module
invoice = self._makeOne( invoice = self._makeOne(
portal_type='Sale Invoice Transaction', portal_type='Sale Invoice Transaction',
start_date=DateTime('2008/09/08'), start_date=DateTime('2008/09/08'),
...@@ -294,8 +287,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -294,8 +287,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
self.tic() self.tic()
self.organisation1.edit( self.organisation1.edit(
price_currency=new_currency.getRelativeUrl()) price_currency=new_currency.getRelativeUrl())
euro = self.portal.currency_module.euro
accounting_module = self.portal.accounting_module
invoice = self._makeOne( invoice = self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
stop_date=DateTime('2008/09/08'), stop_date=DateTime('2008/09/08'),
...@@ -345,7 +336,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -345,7 +336,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
x_curr_ex_line.validate() x_curr_ex_line.validate()
self.assertEqual(x_curr_ex_line.getValidationState(), self.assertEqual(x_curr_ex_line.getValidationState(),
'validated') 'validated')
accounting_module = self.portal.accounting_module
transaction1 = self._makeOne( transaction1 = self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
stop_date=DateTime('2008/09/08'), stop_date=DateTime('2008/09/08'),
...@@ -413,7 +403,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -413,7 +403,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
self.assertEqual(x_curr_ex_line.getValidationState(), self.assertEqual(x_curr_ex_line.getValidationState(),
'validated') 'validated')
accounting_module = self.portal.accounting_module
invoice = self._makeOne( invoice = self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
stop_date=DateTime('2008/09/08'), stop_date=DateTime('2008/09/08'),
...@@ -429,8 +418,7 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -429,8 +418,7 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
line_list = invoice.contentValues( line_list = invoice.contentValues(
portal_type=self.portal.getPortalAccountingMovementTypeList()) portal_type=self.portal.getPortalAccountingMovementTypeList())
for line in line_list: for line in line_list:
self.assertEqual(line.getDestinationTotalAssetPrice(), self.assertEqual(line.getDestinationTotalAssetPrice(), None)
None)
def test_CreateCELWithNoBasePrice(self): def test_CreateCELWithNoBasePrice(self):
...@@ -476,7 +464,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase): ...@@ -476,7 +464,6 @@ class TestCurrencyExchangeLine(CurrencyExchangeTestCase):
self.assertEqual(euro_line2.getValidationState(), self.assertEqual(euro_line2.getValidationState(),
'validated') 'validated')
accounting_module = self.portal.accounting_module
invoice = self._makeOne( invoice = self._makeOne(
portal_type='Purchase Invoice Transaction', portal_type='Purchase Invoice Transaction',
stop_date=DateTime('2008/09/08'), stop_date=DateTime('2008/09/08'),
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testERP5CurrencyExchangeLine</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testERP5CurrencyExchangeLine</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testERP5CurrencyExchangeLine</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testConversionInSimulation
test.erp5.testERP5CurrencyExchangeLine
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_base
erp5_core_proxy_field_legacy
erp5_pdm
erp5_simulation
erp5_trade
erp5_simulation_test erp5_simulation_test
erp5_simplified_invoicing erp5_simplified_invoicing
erp5_configurator_standard_accounting_template erp5_configurator_standard_solver
\ No newline at end of file erp5_configurator_standard_trade_template
erp5_configurator_standard_invoicing_template
\ No newline at end of file
...@@ -35,7 +35,7 @@ from DateTime import DateTime ...@@ -35,7 +35,7 @@ from DateTime import DateTime
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from Products.ERP5.tests.testAccounting import AccountingTestCase from erp5.component.test.testAccounting import AccountingTestCase
class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase): class TestBankReconciliation(AccountingTestCase, ERP5ReportTestCase):
"""Test Bank Reconciliation """Test Bank Reconciliation
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment