Commit dd628917 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

check price calculation for internal packing list too.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29985 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9c92315c
...@@ -51,6 +51,7 @@ class TestResource(ERP5TypeTestCase): ...@@ -51,6 +51,7 @@ class TestResource(ERP5TypeTestCase):
sale_order_line_portal_type = 'Sale Order Line' sale_order_line_portal_type = 'Sale Order Line'
sale_supply_line_portal_type = 'Sale Supply Line' sale_supply_line_portal_type = 'Sale Supply Line'
purchase_supply_line_portal_type = 'Purchase Supply Line' purchase_supply_line_portal_type = 'Purchase Supply Line'
internal_supply_line_portal_type = 'Internal Supply Line'
sale_supply_cell_portal_type = 'Sale Supply Cell' sale_supply_cell_portal_type = 'Sale Supply Cell'
variation_base_category_list = ['colour', 'size', 'morphology', variation_base_category_list = ['colour', 'size', 'morphology',
'industrial_phase'] 'industrial_phase']
...@@ -885,10 +886,10 @@ class TestResource(ERP5TypeTestCase): ...@@ -885,10 +886,10 @@ class TestResource(ERP5TypeTestCase):
product.getPrice(categories=[variation])) product.getPrice(categories=[variation]))
def test_12_getPurchaseVsSalePrice(self, quiet=quiet, run=run_all_test): def test_12_getInternalVsPurchaseVsSalePrice(self, quiet=quiet, run=run_all_test):
""" """
Test the pricing model with purchase and sale supply lines, and with Test the pricing model with internal, purchase and sale supply
source_section/destination_section. lines, and with source_section/destination_section.
""" """
if not run: return if not run: return
# Initialize variables # Initialize variables
...@@ -897,6 +898,7 @@ class TestResource(ERP5TypeTestCase): ...@@ -897,6 +898,7 @@ class TestResource(ERP5TypeTestCase):
currency_module = self.getCurrencyModule() currency_module = self.getCurrencyModule()
sale_order_module = self.portal.getDefaultModule("Sale Order") sale_order_module = self.portal.getDefaultModule("Sale Order")
purchase_order_module = self.portal.getDefaultModule("Purchase Order") purchase_order_module = self.portal.getDefaultModule("Purchase Order")
internal_packing_list_module = self.portal.getDefaultModule("Internal Packing List")
# Create product # Create product
product = product_module.newContent( product = product_module.newContent(
portal_type=self.product_portal_type, portal_type=self.product_portal_type,
...@@ -932,6 +934,18 @@ class TestResource(ERP5TypeTestCase): ...@@ -932,6 +934,18 @@ class TestResource(ERP5TypeTestCase):
product.newContent( product.newContent(
portal_type=self.purchase_supply_line_portal_type, portal_type=self.purchase_supply_line_portal_type,
base_price=40.0) base_price=40.0)
# Create internal supply lines
product.newContent(
portal_type=self.internal_supply_line_portal_type,
base_price=1.0,
destination_section_value=orga1)
product.newContent(
portal_type=self.internal_supply_line_portal_type,
base_price=2.0,
destination_section_value=orga2)
product.newContent(
portal_type=self.internal_supply_line_portal_type,
base_price=4.0)
# Create sale order and check price # Create sale order and check price
sale_order = sale_order_module.newContent( sale_order = sale_order_module.newContent(
portal_type="Sale Order", portal_type="Sale Order",
...@@ -964,6 +978,22 @@ class TestResource(ERP5TypeTestCase): ...@@ -964,6 +978,22 @@ class TestResource(ERP5TypeTestCase):
self.tic() self.tic()
purchase_order_line.setPrice(None) purchase_order_line.setPrice(None)
self.assertEquals(purchase_order_line.getPrice(), 20.0) self.assertEquals(purchase_order_line.getPrice(), 20.0)
# Create internal packing list and check price
internal_packing_list = internal_packing_list_module.newContent(
portal_type="Internal Packing List",
start_date=DateTime(),
stop_date=DateTime())
internal_packing_list_line = internal_packing_list.newContent(
portal_type="Internal Packing List Line",
resource_value=product)
transaction.commit()
self.tic()
self.assertEquals(internal_packing_list_line.getPrice(), 4.0)
internal_packing_list.setDestinationSectionValue(orga2)
transaction.commit()
self.tic()
internal_packing_list_line.setPrice(None)
self.assertEquals(internal_packing_list_line.getPrice(), 2.0)
def testGetPriceWithQuantityUnit(self): def testGetPriceWithQuantityUnit(self):
resource = self.portal.getDefaultModule(self.product_portal_type)\ resource = self.portal.getDefaultModule(self.product_portal_type)\
......
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