Commit 9257af54 authored by Julien Muchembled's avatar Julien Muchembled

Fix acquisition of specialise on cells and update several unit tests

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@38062 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e7cc8b8b
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
</item> </item>
<item> <item>
<key> <string>acquisition_portal_type</string> </key> <key> <string>acquisition_portal_type</string> </key>
<value> <string>python:list(portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList())</string> </value> <value> <string>python:list(portal.getPortalDeliveryTypeList() + portal.getPortalOrderTypeList() + portal.getPortalDeliveryMovementTypeList() + portal.getPortalOrderMovementTypeList())</string> </value>
</item> </item>
<item> <item>
<key> <string>acquisition_sync_value</string> </key> <key> <string>acquisition_sync_value</string> </key>
......
...@@ -67,6 +67,7 @@ class TestOrderMixin(object): ...@@ -67,6 +67,7 @@ class TestOrderMixin(object):
packing_list_cell_portal_type = 'Sale Packing List Cell' packing_list_cell_portal_type = 'Sale Packing List Cell'
delivery_builder_id = 'sale_packing_list_builder' delivery_builder_id = 'sale_packing_list_builder'
size_list = ['Baby','Child/32','Child/34','Man','Woman'] size_list = ['Baby','Child/32','Child/34','Man','Woman']
business_process = 'business_process_module/erp5_default_business_process'
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """
...@@ -314,6 +315,7 @@ class TestOrderMixin(object): ...@@ -314,6 +315,7 @@ class TestOrderMixin(object):
title = "Order%s" % order.getId(), title = "Order%s" % order.getId(),
start_date = self.datetime + 10, start_date = self.datetime + 10,
stop_date = self.datetime + 20, stop_date = self.datetime + 20,
specialise = self.business_process,
) )
if organisation is not None: if organisation is not None:
order.edit(source_value=organisation, order.edit(source_value=organisation,
...@@ -2122,8 +2124,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2122,8 +2124,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal = self.getPortal() portal = self.getPortal()
order_module = portal.getDefaultModule(portal_type=self.order_portal_type) order_module = portal.getDefaultModule(portal_type=self.order_portal_type)
order = order_module.newContent(portal_type=self.order_portal_type) order = order_module.newContent(portal_type=self.order_portal_type,
specialise=self.business_process)
# No line, no movement # No line, no movement
self.assertEquals(0, len(order.getMovementList())) self.assertEquals(0, len(order.getMovementList()))
...@@ -2225,8 +2227,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2225,8 +2227,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
base_id = 'movement' base_id = 'movement'
order_line_vcl=['size/Baby'] order_line_vcl=['size/Baby']
order_module = portal.getDefaultModule(portal_type=self.order_portal_type) order_module = portal.getDefaultModule(portal_type=self.order_portal_type)
order = order_module.newContent(portal_type=self.order_portal_type) order = order_module.newContent(portal_type=self.order_portal_type,
specialise=self.business_process)
# No line, no movement # No line, no movement
self.assertEquals(order.getTotalQuantity(fast=0), 0) self.assertEquals(order.getTotalQuantity(fast=0), 0)
self.assertEquals(order.getTotalQuantity(fast=1), 0) self.assertEquals(order.getTotalQuantity(fast=1), 0)
...@@ -2567,6 +2569,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2567,6 +2569,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Order') title='Order')
line = order.newContent(portal_type=self.order_line_portal_type, line = order.newContent(portal_type=self.order_line_portal_type,
resource_value=resource, resource_value=resource,
...@@ -2627,6 +2630,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2627,6 +2630,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type='Organisation', title='Vendor') portal_type='Organisation', title='Vendor')
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Order', title='Order',
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
...@@ -2662,6 +2666,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2662,6 +2666,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type='Organisation', title='Vendor') portal_type='Organisation', title='Vendor')
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Order', title='Order',
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
...@@ -2698,6 +2703,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2698,6 +2703,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type='Organisation', title='Vendor') portal_type='Organisation', title='Vendor')
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Order', title='Order',
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
...@@ -2735,6 +2741,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2735,6 +2741,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
default_image_file=image) default_image_file=image)
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Order', title='Order',
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
...@@ -2775,6 +2782,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2775,6 +2782,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
self.assertTrue(isinstance(vendor.getDefaultImageValue().data, Pdata)) self.assertTrue(isinstance(vendor.getDefaultImageValue().data, Pdata))
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Order', title='Order',
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
...@@ -2817,6 +2825,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2817,6 +2825,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
default_address_city='Vïllà') default_address_city='Vïllà')
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Ordàr', title='Ordàr',
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
...@@ -2857,6 +2866,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2857,6 +2866,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type='Organisation', title='Vendor') portal_type='Organisation', title='Vendor')
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type, portal_type=self.order_portal_type,
specialise=self.business_process,
title='Order', title='Order',
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
...@@ -2890,7 +2900,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2890,7 +2900,8 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
"""Tests, that modification on Order are propagated to lines and cells """Tests, that modification on Order are propagated to lines and cells
during reindxation""" during reindxation"""
order = self.portal.getDefaultModule(self.order_portal_type).newContent( order = self.portal.getDefaultModule(self.order_portal_type).newContent(
portal_type=self.order_portal_type) portal_type=self.order_portal_type,
specialise=self.business_process)
order_line = order.newContent(portal_type=self.order_line_portal_type) order_line = order.newContent(portal_type=self.order_line_portal_type)
inner_order_line = order_line.newContent( inner_order_line = order_line.newContent(
portal_type=self.order_line_portal_type) portal_type=self.order_line_portal_type)
......
...@@ -1672,13 +1672,13 @@ class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase): ...@@ -1672,13 +1672,13 @@ class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase):
def stepSetUpAutomaticQuantityAcceptSolver(self, sequence=None, sequence_list=None): def stepSetUpAutomaticQuantityAcceptSolver(self, sequence=None, sequence_list=None):
self._setUpTargetSolver('Automatic Quantity Accept Solver', self._setUpTargetSolver('Automatic Quantity Accept Solver',
'AcceptSolver', ('quantity',)) 'AcceptSolver', ('quantity',))
self.portal.portal_rules.default_delivery_simulation_rule.default_quantity_tester.edit( self.portal.portal_rules.new_delivery_simulation_rule.quantity_tester.edit(
solver=('portal_solvers/Automatic Quantity Accept Solver',)) solver=('portal_solvers/Automatic Quantity Accept Solver',))
def stepSetUpAutomaticQuantityAdoptSolver(self, sequence=None, sequence_list=None): def stepSetUpAutomaticQuantityAdoptSolver(self, sequence=None, sequence_list=None):
self._setUpTargetSolver('Automatic Quantity Adopt Solver', self._setUpTargetSolver('Automatic Quantity Adopt Solver',
'AdoptSolver', ('quantity',)) 'AdoptSolver', ('quantity',))
self.portal.portal_rules.default_delivery_simulation_rule.default_quantity_tester.edit( self.portal.portal_rules.new_delivery_simulation_rule.quantity_tester.edit(
solver=('portal_solvers/Automatic Quantity Adopt Solver',)) solver=('portal_solvers/Automatic Quantity Adopt Solver',))
def stepSetUpMovementSplitSolver(self, sequence=None, sequence_list=None): def stepSetUpMovementSplitSolver(self, sequence=None, sequence_list=None):
......
...@@ -39,6 +39,9 @@ class TestTradeModelLinePurchase(TestTradeModelLine): ...@@ -39,6 +39,9 @@ class TestTradeModelLinePurchase(TestTradeModelLine):
packing_list_portal_type = 'Purchase Packing List' packing_list_portal_type = 'Purchase Packing List'
trade_condition_portal_type = 'Purchase Trade Condition' trade_condition_portal_type = 'Purchase Trade Condition'
def packPackingList(self, packing_list):
self.assertEqual(getattr(packing_list, 'getContainerState', None), None)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestTradeModelLinePurchase)) suite.addTest(unittest.makeSuite(TestTradeModelLinePurchase))
......
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