Commit 217ac5b6 authored by Julien Muchembled's avatar Julien Muchembled

testConversionInSimulation.py: remove tabs and trailing spaces

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39965 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e28529a9
......@@ -148,7 +148,7 @@ class TestConversionInSimulation(AccountingTestCase):
'Author'], [])
user = uf.getUserById(self.username).__of__(uf)
newSecurityManager(None, user)
def getBusinessTemplateList(self):
"""
Return the list of business templates we need to run the test.
......@@ -224,7 +224,7 @@ class TestConversionInSimulation(AccountingTestCase):
resource = self.portal.product_module.newContent(
portal_type='Product',
title='Resource',
product_line='apparel')
product_line='apparel')
currency = self.portal.currency_module.newContent(
portal_type='Currency',
title='euro')
......@@ -237,8 +237,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit()
self.tic()#execute transaction
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21))
......@@ -250,7 +250,7 @@ class TestConversionInSimulation(AccountingTestCase):
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Client',
price_currency=new_currency.getRelativeUrl(),
price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -270,11 +270,11 @@ class TestConversionInSimulation(AccountingTestCase):
resource_value=resource,
quantity=1,
price=2)
order.confirm()
transaction.commit()
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
portal_type='Applied Rule')
order_movement = related_applied_rule.contentValues()[0]
......@@ -291,10 +291,10 @@ class TestConversionInSimulation(AccountingTestCase):
delivery_movement.getPriceCurrencyValue())
self.assertEquals\
(invoice_transaction_movement_1.getDestinationTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice()))
round(655.957*delivery_movement.getTotalPrice()))
self.assertEquals\
(invoice_transaction_movement_1.getSourceTotalAssetPrice(),
None)
None)
invoice_transaction_movement_2 =\
invoice_transaction_applied_rule.contentValues()[1]
self.assertEquals(currency,
......@@ -303,8 +303,8 @@ class TestConversionInSimulation(AccountingTestCase):
delivery_movement.getPriceCurrencyValue())
self.assertEquals\
(invoice_transaction_movement_2.getDestinationTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice()))
round(655.957*delivery_movement.getTotalPrice()))
def test_01_simulation_movement_source_asset_price(self,quiet=0,
run=run_all_test):
"""
......@@ -318,7 +318,7 @@ class TestConversionInSimulation(AccountingTestCase):
resource = self.portal.product_module.newContent(
portal_type='Product',
title='Resource',
product_line='apparel')
product_line='apparel')
currency = self.portal.currency_module.newContent(
portal_type='Currency',
title='euro')
......@@ -331,8 +331,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit()
self.tic()#execute transaction
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21))
......@@ -343,12 +343,12 @@ class TestConversionInSimulation(AccountingTestCase):
self.tic()#execute transactio
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Client',
title='Client',
default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Vendor',
price_currency=new_currency.getRelativeUrl(),
price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region)
order = self.portal.sale_order_module.newContent(
portal_type='Sale Order',
......@@ -364,11 +364,11 @@ class TestConversionInSimulation(AccountingTestCase):
resource_value=resource,
quantity=1,
price=2)
order.confirm()
transaction.commit()
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
portal_type='Applied Rule')
order_movement = related_applied_rule.contentValues()[0]
......@@ -385,27 +385,27 @@ class TestConversionInSimulation(AccountingTestCase):
delivery_movement.getPriceCurrencyValue())
self.assertEquals\
(invoice_transaction_movement.getSourceTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice()))
round(655.957*delivery_movement.getTotalPrice()))
self.assertEquals\
(invoice_transaction_movement.getDestinationTotalAssetPrice(),
None)
None)
def test_01_destination_total_asset_price_on_accounting_lines(self,quiet=0,
run=run_all_test):
"""
tests that the delivery builder of the invoice transaction lines
tests that the delivery builder of the invoice transaction lines
copies the destination asset price on the accounting_lines of the invoice
"""
if not run: return
if not quiet:
printAndLog(
'test_01_destination_total_asset_price_on_accounting_lines')
resource = self.portal.product_module.newContent(
portal_type='Product',
title='Resource',
product_line='apparel')
product_line='apparel')
currency = self.portal.currency_module.newContent(
portal_type='Currency',
title='euro')
......@@ -418,8 +418,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit()
self.tic()#execute transaction
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21))
......@@ -430,8 +430,8 @@ class TestConversionInSimulation(AccountingTestCase):
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Client',
price_currency=new_currency.getRelativeUrl(),
title='Client',
price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -478,11 +478,11 @@ class TestConversionInSimulation(AccountingTestCase):
for line in line_list:
self.assertEquals(line.getDestinationTotalAssetPrice(),
round(655.957*delivery_movement.getTotalPrice()))
def test_01_diverged_sale_packing_list_destination_total_asset_price(
self,quiet=0,run=run_all_test):
self,quiet=0,run=run_all_test):
"""
tests that when the sale packing list is divergent on the quantity and
that the resource on simulation movements is different
......@@ -494,11 +494,11 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet:
printAndLog(
'test_01_diverged_sale_packing_list_destination_total_asset_price')
resource = self.portal.product_module.newContent(
portal_type='Product',
title='Resource',
product_line='apparel')
product_line='apparel')
currency = self.portal.currency_module.newContent(
portal_type='Currency',
title='euro')
......@@ -511,8 +511,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit()
self.tic()#execute transaction
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21))
......@@ -523,8 +523,8 @@ class TestConversionInSimulation(AccountingTestCase):
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Client',
price_currency=new_currency.getRelativeUrl(),
title='Client',
price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -555,12 +555,12 @@ class TestConversionInSimulation(AccountingTestCase):
self.assertEquals(related_packing_list_line.getQuantity(),5.0)
old_destination_asset_price = \
round(655.957*related_packing_list_line.getTotalPrice())
related_packing_list_line.edit(quantity=3.0)
transaction.commit()
self.tic()
self.assertEquals(related_packing_list.getCausalityState(),
'diverged')
'diverged')
self._solveDivergence(related_packing_list, 'quantity', 'accept')
transaction.commit()
self.tic()
......@@ -570,7 +570,7 @@ class TestConversionInSimulation(AccountingTestCase):
self.tic()
related_applied_rule = order.getCausalityRelatedValue(
portal_type='Applied Rule')
portal_type='Applied Rule')
order_movement = related_applied_rule.contentValues()[0]
delivery_applied_rule = order_movement.contentValues()[0]
delivery_movement = delivery_applied_rule.contentValues()[0]
......@@ -582,10 +582,10 @@ class TestConversionInSimulation(AccountingTestCase):
self.assertEquals(
invoice_transaction_movement.getDestinationTotalAssetPrice(),
old_destination_asset_price *(3.0/5.0))
def test_01_diverged_purchase_packing_list_source_total_asset_price(
self,quiet=0,run=run_all_test):
self,quiet=0,run=run_all_test):
"""
tests that when the purchase packing list is divergent on the quantity
and that the resource on simulation movements is different
......@@ -597,11 +597,11 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet:
printAndLog(
'test_01_diverged_purchase_packing_list_source_total_asset_price')
resource = self.portal.product_module.newContent(
portal_type='Product',
title='Resource',
product_line='apparel')
product_line='apparel')
currency = self.portal.currency_module.newContent(
portal_type='Currency',
title='euro')
......@@ -614,8 +614,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit()
self.tic()#execute transaction
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21))
......@@ -631,7 +631,7 @@ class TestConversionInSimulation(AccountingTestCase):
vendor = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Vendor',
price_currency=new_currency.getRelativeUrl(),
price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region)
order = self.portal.purchase_order_module.newContent(
portal_type='Purchase Order',
......@@ -658,13 +658,13 @@ class TestConversionInSimulation(AccountingTestCase):
self.assertEquals(related_packing_list_line.getQuantity(),5.0)
old_source_asset_price = \
round(655.957*related_packing_list_line.getTotalPrice())
related_packing_list_line.edit(quantity=3.0)
transaction.commit()
self.tic()
self.assertEquals(related_packing_list.getCausalityState(),
'diverged')
self._solveDivergence(related_packing_list, 'quantity','accept')
transaction.commit()
self.tic()
......@@ -686,9 +686,9 @@ class TestConversionInSimulation(AccountingTestCase):
self.assertEquals(invoice_transaction_movement.\
getSourceTotalAssetPrice(),
old_source_asset_price *(3.0/5.0))
def test_01_delivery_mode_on_sale_packing_list_and_invoice(
self,quiet=0,run=run_all_test):
self,quiet=0,run=run_all_test):
"""
tests that when the sale packing list is divergent on the quantity and
that the resource on simulation movements is different
......@@ -700,11 +700,11 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet:
printAndLog(
'test_01_delivery_mode_on_sale_packing_list_and_invoice')
resource = self.portal.product_module.newContent(
portal_type='Product',
title='Resource',
product_line='apparel')
product_line='apparel')
currency = self.portal.currency_module.newContent(
portal_type='Currency',
title='euro')
......@@ -717,8 +717,8 @@ class TestConversionInSimulation(AccountingTestCase):
transaction.commit()
self.tic()#execute transaction
x_curr_ex_line = currency.newContent(
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
portal_type='Currency Exchange Line',
price_currency=new_currency.getRelativeUrl())
x_curr_ex_line.setTitle('Euro to Francs CFA')
x_curr_ex_line.setBasePrice(655.957)
x_curr_ex_line.setStartDate(DateTime(2008,10,21))
......@@ -729,8 +729,8 @@ class TestConversionInSimulation(AccountingTestCase):
self.tic()#execute transaction
client = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Client',
price_currency=new_currency.getRelativeUrl(),
title='Client',
price_currency=new_currency.getRelativeUrl(),
default_address_region=self.default_region)
vendor = self.portal.organisation_module.newContent(
portal_type='Organisation',
......@@ -744,8 +744,8 @@ class TestConversionInSimulation(AccountingTestCase):
destination_section_value=client,
start_date=DateTime(2008,10, 21),
price_currency_value=currency,
delivery_mode=self.mail_delivery_mode,
incoterm=self.cpt_incoterm,
delivery_mode=self.mail_delivery_mode,
incoterm=self.cpt_incoterm,
specialise_value=self.business_process,
title='Order')
order_line = order.newContent(portal_type='Sale Order Line',
......@@ -773,7 +773,7 @@ class TestConversionInSimulation(AccountingTestCase):
order.getDeliveryMode())
self.assertEquals(related_invoice.getIncoterm(),
order.getIncoterm())
def test_01_quantity_unit_on_sale_packing_list(
self,quiet=0,run=run_all_test):
"""
......@@ -783,7 +783,7 @@ class TestConversionInSimulation(AccountingTestCase):
if not quiet:
printAndLog(
'test_01_quantity_unit_on_sale_packing_list')
resource = self.portal.product_module.newContent(
portal_type='Product',
title='Resource',
......
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