Commit 2e020e64 authored by Sebastien Robin's avatar Sebastien Robin

fixed quantity_unit and business template list

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10457 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 29574092
...@@ -95,7 +95,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa ...@@ -95,7 +95,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
, 'erp5_accounting' , 'erp5_accounting'
, 'erp5_banking_core' # erp5_banking_core contains all generic methods for banking , 'erp5_banking_core' # erp5_banking_core contains all generic methods for banking
, 'erp5_banking_inventory' , 'erp5_banking_inventory'
, 'erp5_banking_cash_to_currency_purchase-0.1.bt5' # erp5_banking_cash_to_currency_purchase contains all method for cash sorting , 'erp5_banking_cash'
) )
def getCashToCurrencyPurchaseModule(self): def getCashToCurrencyPurchaseModule(self):
...@@ -260,7 +260,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa ...@@ -260,7 +260,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
# chek the value of the banknote # chek the value of the banknote
self.assertEqual(self.valid_incoming_line.getPrice(), 20.0) self.assertEqual(self.valid_incoming_line.getPrice(), 20.0)
# check the unit of banknote # check the unit of banknote
self.assertEqual(self.valid_incoming_line.getQuantityUnit(), 'quantity_unit/unit') self.assertEqual(self.valid_incoming_line.getQuantityUnit(), 'unit')
# check we have two delivery cells: (one for year 1992 and one for 2003) # check we have two delivery cells: (one for year 1992 and one for 2003)
self.assertEqual(len(self.valid_incoming_line.objectValues()), 1) self.assertEqual(len(self.valid_incoming_line.objectValues()), 1)
# now check for each variation (years 1992 and 2003) # now check for each variation (years 1992 and 2003)
...@@ -319,7 +319,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa ...@@ -319,7 +319,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
# check the value of coin # check the value of coin
self.assertEqual(self.valid_outgoing_line.getPrice(), 5000.0) self.assertEqual(self.valid_outgoing_line.getPrice(), 5000.0)
# check the unit of coin # check the unit of coin
self.assertEqual(self.valid_outgoing_line.getQuantityUnit(), 'quantity_unit/unit') self.assertEqual(self.valid_outgoing_line.getQuantityUnit(), 'unit')
# check we have two delivery cells: (one for year 1992 and one for 2003) # check we have two delivery cells: (one for year 1992 and one for 2003)
self.assertEqual(len(self.valid_outgoing_line.objectValues()), 2) self.assertEqual(len(self.valid_outgoing_line.objectValues()), 2)
for variation in self.variation_list: for variation in self.variation_list:
...@@ -357,7 +357,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa ...@@ -357,7 +357,7 @@ class TestERP5BankingCashToCurrencyPurchase(TestERP5BankingMixin, ERP5TypeTestCa
# check the value of coin # check the value of coin
self.assertEqual(self.valid_outgoing_line.getPrice(), 100.0) self.assertEqual(self.valid_outgoing_line.getPrice(), 100.0)
# check the unit of coin # check the unit of coin
self.assertEqual(self.valid_outgoing_line.getQuantityUnit(), 'quantity_unit/unit') self.assertEqual(self.valid_outgoing_line.getQuantityUnit(), 'unit')
# check we have two delivery cells: (one for year 1992 and one for 2003) # check we have two delivery cells: (one for year 1992 and one for 2003)
self.assertEqual(len(self.valid_outgoing_line.objectValues()), 2) self.assertEqual(len(self.valid_outgoing_line.objectValues()), 2)
for variation in self.variation_list: for variation in self.variation_list:
......
...@@ -91,12 +91,11 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -91,12 +91,11 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
need to be installed to run the test on. need to be installed to run the test on.
""" """
return ( 'erp5_base' return ( 'erp5_base'
#, 'erp5_trade' , 'erp5_trade'
#, 'erp5_accounting' , 'erp5_accounting'
, 'baobab_unit_test'
, 'erp5_banking_core' # erp5_banking_core contains all generic methods for banking , 'erp5_banking_core' # erp5_banking_core contains all generic methods for banking
, 'erp5_banking_inventory' , 'erp5_banking_inventory'
, 'erp5_banking_cash_to_currency_sale-0.1.bt5' # erp5_banking_cash_to_currency_sale contains all method for cash sorting , 'erp5_banking_cash' # erp5_banking_cash contains all method for cash sorting
) )
def getCashToCurrencySaleModule(self): def getCashToCurrencySaleModule(self):
...@@ -240,31 +239,22 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -240,31 +239,22 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
self.valid_incoming_line = getattr(self.cash_to_currency_sale, 'valid_incoming_line_1') self.valid_incoming_line = getattr(self.cash_to_currency_sale, 'valid_incoming_line_1')
# check its portal type # check its portal type
self.assertEqual(self.valid_incoming_line.getPortalType(), 'Incoming Cash To Currency Sale Line') self.assertEqual(self.valid_incoming_line.getPortalType(), 'Incoming Cash To Currency Sale Line')
# check the resource is banknotes of 10000
self.assertEqual(self.valid_incoming_line.getResourceValue(), self.billet_5000) self.assertEqual(self.valid_incoming_line.getResourceValue(), self.billet_5000)
# chek the value of the banknote
self.assertEqual(self.valid_incoming_line.getPrice(), 5000.0) self.assertEqual(self.valid_incoming_line.getPrice(), 5000.0)
# check the unit of banknote self.assertEqual(self.valid_incoming_line.getQuantityUnit(), 'unit')
self.assertEqual(self.valid_incoming_line.getQuantityUnit(), 'quantity_unit/unit')
# check we have two delivery cells: (one for year 1992 and one for 2003)
self.assertEqual(len(self.valid_incoming_line.objectValues()), 2) self.assertEqual(len(self.valid_incoming_line.objectValues()), 2)
# now check for each variation (years 1992 and 2003)
for variation in self.variation_list: for variation in self.variation_list:
# get the delivery cell # get the delivery cell
cell = self.valid_incoming_line.getCell('emission_letter/not_defined', variation, 'cash_status/valid') cell = self.valid_incoming_line.getCell('emission_letter/not_defined', variation, 'cash_status/valid')
# chek portal types # chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
# check the banknote of the cell is banknote of 10000
self.assertEqual(cell.getResourceValue(), self.billet_5000) self.assertEqual(cell.getResourceValue(), self.billet_5000)
# check the source vault is encaisse_paris
self.assertEqual(cell.getBaobabSource(), None) self.assertEqual(cell.getBaobabSource(), None)
# check the destination vault is guichet_1 # check the destination vault is guichet_1
self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_billets_et_monnaies/entrante') self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_billets_et_monnaies/entrante')
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity of banknote for year 1992 is 2
self.assertEqual(cell.getQuantity(), 4.0) self.assertEqual(cell.getQuantity(), 4.0)
elif cell.getId() == 'movement_0_1_0': elif cell.getId() == 'movement_0_1_0':
# check the quantity of banknote for year 2003 is 3
self.assertEqual(cell.getQuantity(), 6.0) self.assertEqual(cell.getQuantity(), 6.0)
else: else:
self.fail('Wrong cell created : %s' % cell.getId()) self.fail('Wrong cell created : %s' % cell.getId())
...@@ -280,31 +270,24 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -280,31 +270,24 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
self.valid_incoming_line = getattr(self.cash_to_currency_sale, 'valid_incoming_line_2') self.valid_incoming_line = getattr(self.cash_to_currency_sale, 'valid_incoming_line_2')
# check its portal type # check its portal type
self.assertEqual(self.valid_incoming_line.getPortalType(), 'Incoming Cash To Currency Sale Line') self.assertEqual(self.valid_incoming_line.getPortalType(), 'Incoming Cash To Currency Sale Line')
# check the resource is banknotes of 10000
self.assertEqual(self.valid_incoming_line.getResourceValue(), self.piece_100) self.assertEqual(self.valid_incoming_line.getResourceValue(), self.piece_100)
# chek the value of the banknote # chek the value of the banknote
self.assertEqual(self.valid_incoming_line.getPrice(), 100.0) self.assertEqual(self.valid_incoming_line.getPrice(), 100.0)
# check the unit of banknote # check the unit of banknote
self.assertEqual(self.valid_incoming_line.getQuantityUnit(), 'quantity_unit/unit') self.assertEqual(self.valid_incoming_line.getQuantityUnit(), 'unit')
# check we have two delivery cells: (one for year 1992 and one for 2003)
self.assertEqual(len(self.valid_incoming_line.objectValues()), 2) self.assertEqual(len(self.valid_incoming_line.objectValues()), 2)
# now check for each variation (years 1992 and 2003)
for variation in self.variation_list: for variation in self.variation_list:
# get the delivery cell # get the delivery cell
cell = self.valid_incoming_line.getCell('emission_letter/not_defined', variation, 'cash_status/valid') cell = self.valid_incoming_line.getCell('emission_letter/not_defined', variation, 'cash_status/valid')
# chek portal types # chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
# check the banknote of the cell is banknote of 10000
self.assertEqual(cell.getResourceValue(), self.piece_100) self.assertEqual(cell.getResourceValue(), self.piece_100)
# check the source vault is encaisse_paris
self.assertEqual(cell.getBaobabSource(), None) self.assertEqual(cell.getBaobabSource(), None)
# check the destination vault is guichet_1 # check the destination vault is guichet_1
self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_billets_et_monnaies/entrante') self.assertEqual(cell.getBaobabDestination(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_billets_et_monnaies/entrante')
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity of banknote for year 1992 is 2
self.assertEqual(cell.getQuantity(), 200.0) self.assertEqual(cell.getQuantity(), 200.0)
elif cell.getId() == 'movement_0_1_0': elif cell.getId() == 'movement_0_1_0':
# check the quantity of banknote for year 2003 is 3
self.assertEqual(cell.getQuantity(), 0.0) self.assertEqual(cell.getQuantity(), 0.0)
else: else:
self.fail('Wrong cell created : %s' % cell.getId()) self.fail('Wrong cell created : %s' % cell.getId())
...@@ -317,7 +300,6 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -317,7 +300,6 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
""" """
# Check number of lines # Check number of lines
self.assertEqual(len(self.cash_to_currency_sale.objectValues()), 2) self.assertEqual(len(self.cash_to_currency_sale.objectValues()), 2)
# Check quantity of banknotes (2 for 1992 and 3 for 2003)
self.assertEqual(self.cash_to_currency_sale.getTotalQuantity(deliveryLineType="Incoming Cash To Currency Sale Line"), 210) self.assertEqual(self.cash_to_currency_sale.getTotalQuantity(deliveryLineType="Incoming Cash To Currency Sale Line"), 210)
# Check the total price # Check the total price
self.assertEqual(self.cash_to_currency_sale.getTotalPrice(deliveryLineType="Incoming Cash To Currency Sale Line"), 5000 * 4.0 + 100 * 0.0 + 5000 * 6.0 + 100 * 200.0) self.assertEqual(self.cash_to_currency_sale.getTotalPrice(deliveryLineType="Incoming Cash To Currency Sale Line"), 5000 * 4.0 + 100 * 0.0 + 5000 * 6.0 + 100 * 200.0)
...@@ -348,32 +330,20 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -348,32 +330,20 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
self.assertEqual(self.valid_outgoing_line.getResourceValue(), self.usd_billet_20) self.assertEqual(self.valid_outgoing_line.getResourceValue(), self.usd_billet_20)
# chek the value of the banknote # chek the value of the banknote
self.assertEqual(self.valid_outgoing_line.getPrice(), 20.0) self.assertEqual(self.valid_outgoing_line.getPrice(), 20.0)
# check the unit of banknote self.assertEqual(self.valid_outgoing_line.getQuantityUnit(), 'unit')
self.assertEqual(self.valid_outgoing_line.getQuantityUnit(), 'quantity_unit/unit')
# check we have two delivery cells: (one for year 1992 and one for 2003)
self.assertEqual(len(self.valid_outgoing_line.objectValues()), 1) self.assertEqual(len(self.valid_outgoing_line.objectValues()), 1)
# now check for each variation (years 1992 and 2003)
for variation in self.usd_variation_list: for variation in self.usd_variation_list:
# get the delivery cell
cell = self.valid_outgoing_line.getCell('emission_letter/not_defined', variation, 'cash_status/not_defined') cell = self.valid_outgoing_line.getCell('emission_letter/not_defined', variation, 'cash_status/not_defined')
# chek portal types
self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell') self.assertEqual(cell.getPortalType(), 'Cash Delivery Cell')
# check the banknote of the cell is banknote of 10000
self.assertEqual(cell.getResourceValue(), self.usd_billet_20) self.assertEqual(cell.getResourceValue(), self.usd_billet_20)
# check the source vault is encaisse_paris
self.assertEqual(cell.getBaobabSource(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_devises/usd/sortante') self.assertEqual(cell.getBaobabSource(), 'site/testsite/paris/surface/banque_interne/guichet_1/encaisse_des_devises/usd/sortante')
# check the destination vault is guichet_1
self.assertEqual(cell.getBaobabDestination(), None) self.assertEqual(cell.getBaobabDestination(), None)
if cell.getId() == 'movement_0_0_0': if cell.getId() == 'movement_0_0_0':
# check the quantity of banknote 20
self.assertEqual(cell.getQuantity(), 5.0) self.assertEqual(cell.getQuantity(), 5.0)
else: else:
self.fail('Wrong cell created : %s' % cell.getId()) self.fail('Wrong cell created : %s' % cell.getId())
def stepCheckTotal(self, sequence=None, sequence_list=None, **kwd): def stepCheckTotal(self, sequence=None, sequence_list=None, **kwd):
""" """
Check the total after the creation of the two cash exchange lines Check the total after the creation of the two cash exchange lines
...@@ -385,9 +355,6 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase): ...@@ -385,9 +355,6 @@ class TestERP5BankingCashToCurrencySale(TestERP5BankingMixin, ERP5TypeTestCase):
# check the total price # check the total price
self.assertEqual(self.cash_to_currency_sale.getTotalPrice(deliveryLineType="Outgoing Cash To Currency Sale Line"), 20 * 5.0) self.assertEqual(self.cash_to_currency_sale.getTotalPrice(deliveryLineType="Outgoing Cash To Currency Sale Line"), 20 * 5.0)
def stepDeliverCashToCurrencySale(self, sequence=None, sequence_list=None, **kwd): def stepDeliverCashToCurrencySale(self, sequence=None, sequence_list=None, **kwd):
""" """
Deliver the cash sorting with a good user Deliver the cash sorting with a good user
......
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