Commit 0862b6ae authored by Julien Muchembled's avatar Julien Muchembled

Many fixes in testInvoice

In particular, merge patches from testERP5Simulation.

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@38139 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8afc48e1
...@@ -35,8 +35,8 @@ import transaction ...@@ -35,8 +35,8 @@ import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from testPackingList import TestPackingList, TestPackingListMixin from testPackingList import TestPackingListMixin
from testInvoice import TestSaleInvoice, TestInvoiceMixin from testInvoice import TestInvoiceMixin
from Products.ERP5Type.tests.backportUnittest import expectedFailure from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type.Document.BusinessTemplate import getChainByType from Products.ERP5Type.Document.BusinessTemplate import getChainByType
...@@ -49,73 +49,6 @@ class TestERP5SimulationMixin(TestInvoiceMixin): ...@@ -49,73 +49,6 @@ class TestERP5SimulationMixin(TestInvoiceMixin):
pay_business_link.setSource('account_module/bank') pay_business_link.setSource('account_module/bank')
pay_business_link.setDestination('account_module/bank') pay_business_link.setDestination('account_module/bank')
@UnrestrictedMethod
def createInvoiceTransactionRule(self, resource=None):
"""Create a sale invoice transaction rule with only one cell for
product_line/apparel and default_region
The accounting rule cell will have the provided resource, but this his more
or less optional (as long as price currency is set correctly on order)
"""
portal = self.portal
account_module = portal.account_module
for account_id, account_gap, account_type \
in self.account_definition_list:
if not account_id in account_module.objectIds():
account = account_module.newContent(id=account_id)
account.setGap(account_gap)
account.setAccountType(account_type)
portal.portal_workflow.doActionFor(account, 'validate_action')
invoice_rule = portal.portal_rules.new_invoice_transaction_simulation_rule
if invoice_rule.getValidationState() == 'validated':
invoice_rule.invalidate()
invoice_rule.deleteContent(list(invoice_rule.contentIds(filter={'portal_type':['Predicate', 'Accounting Rule Cell']})))
transaction.commit()
self.tic()
region_predicate = invoice_rule.newContent(portal_type = 'Predicate')
product_line_predicate = invoice_rule.newContent(portal_type = 'Predicate')
region_predicate.edit(
membership_criterion_base_category_list = ['destination_region'],
membership_criterion_category_list =
['destination_region/region/%s' % self.default_region ],
int_index = 1,
string_index = 'region'
)
product_line_predicate.edit(
membership_criterion_base_category_list = ['product_line'],
membership_criterion_category_list =
['product_line/apparel'],
int_index = 1,
string_index = 'product'
)
product_line_predicate.immediateReindexObject()
region_predicate.immediateReindexObject()
invoice_rule.updateMatrix()
cell_list = invoice_rule.getCellValueList(base_id='movement')
self.assertEquals(len(cell_list),1)
cell = cell_list[0]
for line_id, line_source_id, line_destination_id, line_ratio in \
self.transaction_line_definition_list:
line = cell.newContent(id=line_id,
portal_type='Accounting Transaction Line', quantity=line_ratio,
resource_value=resource,
source_value=account_module[line_source_id],
destination_value=account_module[line_destination_id])
invoice_rule.validate()
transaction.commit()
self.tic()
def validateNewRules(self):
# create an Order Rule document.
portal_rules = self.portal.portal_rules
new_order_rule = filter(
lambda x:x.title == 'New Default Order Root Simulation Rule',
portal_rules.objectValues(portal_type='Order Root Simulation Rule'))[0]
if new_order_rule.getValidationState() != 'validated':
new_order_rule.validate()
class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase): class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase):
run_all_test = 1 run_all_test = 1
quiet = 0 quiet = 0
...@@ -277,52 +210,7 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase): ...@@ -277,52 +210,7 @@ class TestERP5Simulation(TestERP5SimulationMixin, ERP5TypeTestCase):
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
class TestERP5SimulationInvoice(TestERP5SimulationMixin, TestSaleInvoice): class TestAutomaticSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase):
quiet = TestSaleInvoice.quiet
def test_09_InvoiceChangeStartDateFail(self, quiet=quiet):
"""
Change the start_date of a Invoice Line,
check that the invoice is divergent,
then accept decision, and check Packing list is *not* divergent,
because Unify Solver does not propagage the change to the upper
simulation movement.
"""
if not quiet:
self.logMessage('Invoice Change Sart Date')
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
"""
stepSetReadyPackingList
stepTic
stepStartPackingList
stepCheckInvoicingRule
stepCheckInvoiceTransactionRule
stepTic
stepCheckInvoiceBuilding
stepChangeInvoiceStartDate
stepCheckInvoiceIsDivergent
stepCheckInvoiceIsCalculating
stepTic
stepCheckInvoiceIsDiverged
stepUnifyStartDateWithDecisionInvoice
stepTic
stepCheckInvoiceNotSplitted
stepCheckInvoiceIsNotDivergent
stepCheckInvoiceIsSolved
stepCheckPackingListIsNotDivergent
stepCheckPackingListIsSolved
stepCheckInvoiceTransactionRule
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
"""
self.playSequence(sequence, quiet=quiet)
class TestAutomaticSolvingPackingList(TestERP5SimulationMixin, TestPackingListMixin,
ERP5TypeTestCase):
quiet = 0 quiet = 0
def afterSetUp(self, quiet=1, run=1): def afterSetUp(self, quiet=1, run=1):
...@@ -424,7 +312,5 @@ class TestAutomaticSolvingPackingList(TestERP5SimulationMixin, TestPackingListMi ...@@ -424,7 +312,5 @@ class TestAutomaticSolvingPackingList(TestERP5SimulationMixin, TestPackingListMi
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestERP5Simulation)) suite.addTest(unittest.makeSuite(TestERP5Simulation))
suite.addTest(unittest.makeSuite(TestERP5SimulationPackingList))
suite.addTest(unittest.makeSuite(TestERP5SimulationInvoice))
suite.addTest(unittest.makeSuite(TestAutomaticSolvingPackingList)) suite.addTest(unittest.makeSuite(TestAutomaticSolvingPackingList))
return suite return suite
...@@ -42,10 +42,8 @@ from Acquisition import aq_parent ...@@ -42,10 +42,8 @@ from Acquisition import aq_parent
from zLOG import LOG from zLOG import LOG
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from testPackingList import TestPackingListMixin from testPackingList import TestPackingListMixin
from testAccountingRules import TestAccountingRulesMixin
class TestInvoiceMixin(TestPackingListMixin, class TestInvoiceMixin(TestPackingListMixin):
TestAccountingRulesMixin,):
"""Test methods for invoices """Test methods for invoices
""" """
default_region = "europe/west/france" default_region = "europe/west/france"
...@@ -120,21 +118,12 @@ class TestInvoiceMixin(TestPackingListMixin, ...@@ -120,21 +118,12 @@ class TestInvoiceMixin(TestPackingListMixin,
def afterSetUp(self): def afterSetUp(self):
self.createCategories() self.createCategories()
self.validateRules() self.validateRules()
self.createBusinessProcess()
self.login() self.login()
self.oldMailHost = getattr(self.portal, 'MailHost', None)
if self.oldMailHost is not None:
self.portal.manage_delObjects(['MailHost'])
self.portal._setObject('MailHost', DummyMailHost('MailHost'))
transaction.commit()
self.tic()
def beforeTearDown(self): def beforeTearDown(self):
transaction.abort() transaction.abort()
self.tic() super(TestInvoiceMixin, self).beforeTearDown()
# restore the original MailHost
if self.oldMailHost is not None:
self.portal.manage_delObjects(['MailHost'])
self.portal._setObject('MailHost', DummyMailHost('MailHost'))
for folder in (self.portal.accounting_module, for folder in (self.portal.accounting_module,
self.portal.organisation_module, self.portal.organisation_module,
self.portal.sale_order_module, self.portal.sale_order_module,
...@@ -142,9 +131,7 @@ class TestInvoiceMixin(TestPackingListMixin, ...@@ -142,9 +131,7 @@ class TestInvoiceMixin(TestPackingListMixin,
self.portal.sale_packing_list_module, self.portal.sale_packing_list_module,
self.portal.purchase_packing_list_module, self.portal.purchase_packing_list_module,
self.portal.portal_simulation,): self.portal.portal_simulation,):
folder.manage_delObjects([x for x in folder.objectIds() if x not in ('organisation_1','organisation_2','ppl_1','ppl_2')]) folder.manage_delObjects([x for x in folder.objectIds() if x not in ('organisation_1','organisation_2','ppl_1','ppl_2')])
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -156,68 +143,44 @@ class TestInvoiceMixin(TestPackingListMixin, ...@@ -156,68 +143,44 @@ class TestInvoiceMixin(TestPackingListMixin,
user = uf.getUserById('test_invoice_user').__of__(uf) user = uf.getUserById('test_invoice_user').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def stepCreateSaleInvoiceTransactionRule(self, sequence, **kw) : ## XXX move this to "Sequence class"
"""Create the rule for accounting. """ def playSequence(self, sequence_string, quiet=0) :
self.createInvoiceTransactionRule(resource=sequence.get('resource')) sequence_list = SequenceList()
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
@UnrestrictedMethod def createBusinessProcess(self):
def createInvoiceTransactionRule(self, resource=None):
"""Create a sale invoice transaction rule with only one cell for
product_line/apparel and default_region
The accounting rule cell will have the provided resource, but this his more
or less optional (as long as price currency is set correctly on order)
"""
portal = self.portal portal = self.portal
business_process_id = self.__class__.__name__
try:
business_process = portal.business_process_module[business_process_id]
except KeyError:
business_process = portal.business_process_module.newContent(
business_process_id, 'Business Process',
specialise=self.__class__.business_process)
kw = dict(portal_type='Trade Model Path',
trade_phase='default/accounting',
trade_date='trade_phase/default/invoicing',
membership_criterion_base_category_list=('destination_region',
'product_line'),
membership_criterion_category=(
'destination_region/region/' + self.default_region,
'product_line/apparel'))
account_module = portal.account_module account_module = portal.account_module
for account_id, account_gap, account_type \ for account_id, account_gap, account_type in self.account_definition_list:
in self.account_definition_list: if not account_module.has_key(account_id):
if not account_id in account_module.objectIds(): account = account_module.newContent(account_id, gap=account_gap,
account = account_module.newContent(id=account_id) account_type=account_type)
account.setGap(account_gap)
account.setAccountType(account_type)
portal.portal_workflow.doActionFor(account, 'validate_action') portal.portal_workflow.doActionFor(account, 'validate_action')
invoice_rule = portal.portal_rules.default_invoice_transaction_simulation_rule
if invoice_rule.getValidationState() == 'validated':
invoice_rule.invalidate()
invoice_rule.deleteContent(list(invoice_rule.objectIds()))
transaction.commit()
self.tic()
region_predicate = invoice_rule.newContent(portal_type = 'Predicate')
product_line_predicate = invoice_rule.newContent(portal_type = 'Predicate')
region_predicate.edit(
membership_criterion_base_category_list = ['destination_region'],
membership_criterion_category_list =
['destination_region/region/%s' % self.default_region ],
int_index = 1,
string_index = 'region'
)
product_line_predicate.edit(
membership_criterion_base_category_list = ['product_line'],
membership_criterion_category_list =
['product_line/apparel'],
int_index = 1,
string_index = 'product'
)
product_line_predicate.immediateReindexObject()
region_predicate.immediateReindexObject()
invoice_rule.updateMatrix()
cell_list = invoice_rule.getCellValueList(base_id='movement')
self.assertEquals(len(cell_list),1)
cell = cell_list[0]
for line_id, line_source_id, line_destination_id, line_ratio in \ for line_id, line_source_id, line_destination_id, line_ratio in \
self.transaction_line_definition_list: self.transaction_line_definition_list:
line = cell.newContent(id=line_id, business_process.newContent(
portal_type='Accounting Transaction Line', quantity=line_ratio, reference='accounting_' + line_id,
resource_value=resource, efficiency=line_ratio,
source_value=account_module[line_source_id], source_value=account_module[line_source_id],
destination_value=account_module[line_destination_id]) destination_value=account_module[line_destination_id],
**kw)
invoice_rule.validate() self.business_process = business_process.getRelativeUrl()
transaction.commit()
self.tic()
def stepCreateEntities(self, sequence, **kw) : def stepCreateEntities(self, sequence, **kw) :
"""Create a vendor and two clients. """ """Create a vendor and two clients. """
...@@ -727,7 +690,7 @@ class TestInvoiceMixin(TestPackingListMixin, ...@@ -727,7 +690,7 @@ class TestInvoiceMixin(TestPackingListMixin,
portal_type=self.invoice_transaction_line_portal_type))) portal_type=self.invoice_transaction_line_portal_type)))
self.assertEquals(3,len(new_invoice.objectValues( self.assertEquals(3,len(new_invoice.objectValues(
portal_type=self.invoice_transaction_line_portal_type))) portal_type=self.invoice_transaction_line_portal_type)))
account_module = self.getAccountModule() account_module = self.portal.account_module
found_dict = {} found_dict = {}
for line in invoice.objectValues( for line in invoice.objectValues(
portal_type=self.invoice_transaction_line_portal_type): portal_type=self.invoice_transaction_line_portal_type):
...@@ -761,7 +724,7 @@ class TestInvoiceMixin(TestPackingListMixin, ...@@ -761,7 +724,7 @@ class TestInvoiceMixin(TestPackingListMixin,
sequence_list=None, **kw): sequence_list=None, **kw):
"""Rebuilds with sale_invoice_builder and checks nothing more is """Rebuilds with sale_invoice_builder and checks nothing more is
created. """ created. """
accounting_module = self.getAccountingModule() accounting_module = self.portal.accounting_module
portal_type_list = ('Sale Invoice Transaction', 'Purchase Invoice Transaction') portal_type_list = ('Sale Invoice Transaction', 'Purchase Invoice Transaction')
sale_invoice_transaction_count = len(accounting_module.objectValues( sale_invoice_transaction_count = len(accounting_module.objectValues(
portal_type=portal_type_list)) portal_type=portal_type_list))
...@@ -1195,8 +1158,6 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1195,8 +1158,6 @@ class TestInvoice(TestInvoiceMixin):
portal_type='Currency', portal_type='Currency',
title='Currency', title='Currency',
base_unit_quantity=0.01) base_unit_quantity=0.01)
self.createInvoiceTransactionRule(currency)
client = self.portal.organisation_module.newContent( client = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Client', title='Client',
...@@ -1209,6 +1170,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1209,6 +1170,7 @@ class TestInvoice(TestInvoiceMixin):
default_address_region=self.default_region) default_address_region=self.default_region)
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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1266,6 +1228,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1266,6 +1228,7 @@ class TestInvoice(TestInvoiceMixin):
price_currency= currency.getRelativeUrl()) price_currency= currency.getRelativeUrl())
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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1457,8 +1420,6 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1457,8 +1420,6 @@ class TestInvoice(TestInvoiceMixin):
portal_type='Currency', portal_type='Currency',
title='Currency', title='Currency',
base_unit_quantity=0.01) base_unit_quantity=0.01)
self.createInvoiceTransactionRule(currency)
client = self.portal.organisation_module.newContent( client = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Client', title='Client',
...@@ -1469,6 +1430,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1469,6 +1430,7 @@ class TestInvoice(TestInvoiceMixin):
default_address_region=self.default_region) default_address_region=self.default_region)
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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1675,6 +1637,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1675,6 +1637,7 @@ class TestInvoice(TestInvoiceMixin):
portal_type=self.invoice_portal_type, portal_type=self.invoice_portal_type,
start_date=DateTime(2008, 12, 31), start_date=DateTime(2008, 12, 31),
title='Invoice', title='Invoice',
specialise=self.business_process,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1714,6 +1677,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1714,6 +1677,7 @@ class TestInvoice(TestInvoiceMixin):
portal_type=self.invoice_portal_type, portal_type=self.invoice_portal_type,
start_date=DateTime(2008, 12, 31), start_date=DateTime(2008, 12, 31),
title='Invoice', title='Invoice',
specialise=self.business_process,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1765,6 +1729,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1765,6 +1729,7 @@ class TestInvoice(TestInvoiceMixin):
portal_type=self.invoice_portal_type, portal_type=self.invoice_portal_type,
start_date=DateTime(2008, 12, 31), start_date=DateTime(2008, 12, 31),
title='Invoice', title='Invoice',
specialise=self.business_process,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1804,6 +1769,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1804,6 +1769,7 @@ class TestInvoice(TestInvoiceMixin):
title='Vendor') 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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1900,6 +1866,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -1900,6 +1866,7 @@ class TestInvoice(TestInvoiceMixin):
no_order_packing_list = \ no_order_packing_list = \
self.portal.getDefaultModule(self.packing_list_portal_type).newContent( self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
portal_type=self.packing_list_portal_type, portal_type=self.packing_list_portal_type,
specialise=self.business_process,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1992,6 +1959,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -1992,6 +1959,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
title='Vendor') 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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -2088,6 +2056,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -2088,6 +2056,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
title='Vendor') 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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -2173,7 +2142,6 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -2173,7 +2142,6 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
portal_type='Currency', portal_type='Currency',
title='euro') title='euro')
currency.setBaseUnitQuantity(0.01) currency.setBaseUnitQuantity(0.01)
self.createInvoiceTransactionRule(currency)
transaction.commit() transaction.commit()
self.tic()#execute transaction self.tic()#execute transaction
client = self.portal.organisation_module.newContent( client = self.portal.organisation_module.newContent(
...@@ -2186,6 +2154,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -2186,6 +2154,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
default_address_region=self.default_region) default_address_region=self.default_region)
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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -2250,6 +2219,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent( ...@@ -2250,6 +2219,7 @@ self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
default_address_region=self.default_region) default_address_region=self.default_region)
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,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -2470,7 +2440,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin, ...@@ -2470,7 +2440,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
PACKING_LIST_DEFAULT_SEQUENCE = """ PACKING_LIST_DEFAULT_SEQUENCE = """
stepCreateEntities stepCreateEntities
stepCreateCurrency stepCreateCurrency
stepCreateSaleInvoiceTransactionRule
stepCreateOrder stepCreateOrder
stepSetOrderProfile stepSetOrderProfile
stepSetOrderPriceCurrency stepSetOrderPriceCurrency
...@@ -2498,7 +2467,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin, ...@@ -2498,7 +2467,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
PACKING_LIST_TWO_LINES_DEFAULT_SEQUENCE = """ PACKING_LIST_TWO_LINES_DEFAULT_SEQUENCE = """
stepCreateEntities stepCreateEntities
stepCreateCurrency stepCreateCurrency
stepCreateSaleInvoiceTransactionRule
stepCreateOrder stepCreateOrder
stepSetOrderProfile stepSetOrderProfile
stepSetOrderPriceCurrency stepSetOrderPriceCurrency
...@@ -2532,7 +2500,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin, ...@@ -2532,7 +2500,6 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
TWO_PACKING_LIST_DEFAULT_SEQUENCE = """ TWO_PACKING_LIST_DEFAULT_SEQUENCE = """
stepCreateEntities stepCreateEntities
stepCreateCurrency stepCreateCurrency
stepCreateSaleInvoiceTransactionRule
stepCreateOrder stepCreateOrder
stepSetOrderProfile stepSetOrderProfile
stepSetOrderPriceCurrency stepSetOrderPriceCurrency
...@@ -2602,6 +2569,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): ...@@ -2602,6 +2569,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepRebuildAndCheckNothingIsCreated stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency stepCheckInvoicesConsistency
stepCheckInvoiceLineHasReferenceAndIntIndex stepCheckInvoiceLineHasReferenceAndIntIndex
Pdb
""") """)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
...@@ -2665,6 +2633,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): ...@@ -2665,6 +2633,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepEditInvoice stepEditInvoice
stepCheckInvoiceRuleNotAppliedOnInvoiceEdit stepCheckInvoiceRuleNotAppliedOnInvoiceEdit
stepCheckInvoicesConsistency stepCheckInvoicesConsistency
stepTic
""") """)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
...@@ -2683,6 +2652,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): ...@@ -2683,6 +2652,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepEditPackingList stepEditPackingList
stepCheckDeliveryRuleNotAppliedOnPackingListEdit stepCheckDeliveryRuleNotAppliedOnPackingListEdit
stepCheckInvoicesConsistency stepCheckInvoicesConsistency
stepTic
""") """)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
...@@ -2731,6 +2701,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): ...@@ -2731,6 +2701,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckInvoiceBuilding stepCheckInvoiceBuilding
stepRebuildAndCheckNothingIsCreated stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency stepCheckInvoicesConsistency
stepTic
""") """)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
...@@ -2804,10 +2775,12 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): ...@@ -2804,10 +2775,12 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
""" """
Change the start_date of a Invoice Line, Change the start_date of a Invoice Line,
check that the invoice is divergent, check that the invoice is divergent,
then accept decision, and check Packing list is divergent then accept decision, and check Packing list is *not* divergent,
because Unify Solver does not propagage the change to the upper
simulation movement.
""" """
if not quiet: if not quiet:
self.logMessage('Invoice Change Sart Date') self.logMessage('Invoice Change Start Date')
sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \ sequence = self.PACKING_LIST_DEFAULT_SEQUENCE + \
""" """
stepSetReadyPackingList stepSetReadyPackingList
...@@ -2830,7 +2803,12 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase): ...@@ -2830,7 +2803,12 @@ class TestSaleInvoice(TestSaleInvoiceMixin, TestInvoice, ERP5TypeTestCase):
stepCheckInvoiceIsNotDivergent stepCheckInvoiceIsNotDivergent
stepCheckInvoiceIsSolved stepCheckInvoiceIsSolved
stepCheckPackingListIsDivergent stepCheckPackingListIsNotDivergent
stepCheckPackingListIsSolved
stepCheckInvoiceTransactionRule
stepRebuildAndCheckNothingIsCreated
stepCheckInvoicesConsistency
""" """
self.playSequence(sequence, quiet=quiet) self.playSequence(sequence, quiet=quiet)
...@@ -3504,7 +3482,6 @@ class TestPurchaseInvoice(TestInvoice, ERP5TypeTestCase): ...@@ -3504,7 +3482,6 @@ class TestPurchaseInvoice(TestInvoice, ERP5TypeTestCase):
PACKING_LIST_DEFAULT_SEQUENCE = """ PACKING_LIST_DEFAULT_SEQUENCE = """
stepCreateEntities stepCreateEntities
stepCreateCurrency stepCreateCurrency
stepCreateSaleInvoiceTransactionRule
stepCreateOrder stepCreateOrder
stepSetOrderProfile stepSetOrderProfile
stepSetOrderPriceCurrency stepSetOrderPriceCurrency
......
...@@ -51,6 +51,7 @@ class TestOrderMixin(SubcontentReindexingWrapper): ...@@ -51,6 +51,7 @@ class TestOrderMixin(SubcontentReindexingWrapper):
order_line_portal_type = 'Sale Order Line' order_line_portal_type = 'Sale Order Line'
order_cell_portal_type = 'Sale Order Cell' order_cell_portal_type = 'Sale Order Cell'
applied_rule_portal_type = 'Applied Rule' applied_rule_portal_type = 'Applied Rule'
simulation_movement_portal_type = 'Simulation Movement'
datetime = DateTime() datetime = DateTime()
packing_list_portal_type = 'Sale Packing List' packing_list_portal_type = 'Sale Packing List'
packing_list_line_portal_type = 'Sale Packing List Line' packing_list_line_portal_type = 'Sale Packing List Line'
......
...@@ -1464,7 +1464,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -1464,7 +1464,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
packing_list = self.portal.getDefaultModule(self.packing_list_portal_type).newContent( packing_list = self.portal.getDefaultModule(self.packing_list_portal_type).newContent(
portal_type=self.packing_list_portal_type, portal_type=self.packing_list_portal_type,
title='Packing List', title='Packing List',
specialise='business_process_module/erp5_default_business_process', specialise=self.business_process,
source_value=vendor, source_value=vendor,
source_section_value=vendor, source_section_value=vendor,
destination_value=client, destination_value=client,
...@@ -1538,7 +1538,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -1538,7 +1538,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
portal_type=self.packing_list_portal_type, portal_type=self.packing_list_portal_type,
source_value=source, source_value=source,
destination_value=destination, destination_value=destination,
specialise='business_process_module/erp5_default_business_process', specialise=self.business_process,
start_date=DateTime()) start_date=DateTime())
packing_list_line = packing_list.newContent( packing_list_line = packing_list.newContent(
portal_type=self.packing_list_line_portal_type, portal_type=self.packing_list_line_portal_type,
...@@ -1778,9 +1778,7 @@ class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase): ...@@ -1778,9 +1778,7 @@ class TestSolvingPackingList(TestPackingListMixin, ERP5TypeTestCase):
self.portal.portal_solvers.manage_delObjects(self.added_target_solver_list) self.portal.portal_solvers.manage_delObjects(self.added_target_solver_list)
transaction.commit() transaction.commit()
self.tic() self.tic()
beforeTearDown = getattr(TestPackingListMixin, 'beforeTearDown', super(TestSolvingPackingList, self).beforeTearDown()
ERP5TypeTestCase.beforeTearDown)
beforeTearDown(self)
@UnrestrictedMethod @UnrestrictedMethod
def _setUpTargetSolver(self, solver_id, solver_class, tested_property_list): def _setUpTargetSolver(self, solver_id, solver_class, tested_property_list):
......
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