Commit 22b15847 authored by Jérome Perrin's avatar Jérome Perrin

set account_type on accounts to preven validation errors.

also set a region on organisations and validate them.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18224 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 89eec097
...@@ -57,15 +57,15 @@ class TestInvoice(TestPackingListMixin, ...@@ -57,15 +57,15 @@ class TestInvoice(TestPackingListMixin,
sale_gap = 'fr/pcg/7/70/707/7071/70712' sale_gap = 'fr/pcg/7/70/707/7071/70712'
customer_gap = 'fr/pcg/4/41/411' customer_gap = 'fr/pcg/4/41/411'
# (account_id, account_gap) # (account_id, account_gap, account_type)
#XXX gap for the last 3 should be set to real values #XXX gap for the last 3 should be set to real values
account_definition_list = ( account_definition_list = (
('receivable_vat', vat_gap), ('receivable_vat', vat_gap, 'liability/payable/collected_vat',),
('sale', sale_gap), ('sale', sale_gap, 'income'),
('customer', customer_gap), ('customer', customer_gap, 'asset/receivable'),
('refundable_vat', vat_gap), ('refundable_vat', vat_gap, 'asset/receivable/refundable_vat'),
('purchase', sale_gap), ('purchase', sale_gap, 'expense'),
('supplier', customer_gap), ('supplier', customer_gap, 'liability/payable'),
) )
# (line_id, source_account_id, destination_account_id, line_quantity) # (line_id, source_account_id, destination_account_id, line_quantity)
transaction_line_definition_list = ( transaction_line_definition_list = (
...@@ -131,13 +131,18 @@ class TestInvoice(TestPackingListMixin, ...@@ -131,13 +131,18 @@ class TestInvoice(TestPackingListMixin,
self.stepCreateOrganisation1(sequence, **kw) self.stepCreateOrganisation1(sequence, **kw)
self.stepCreateOrganisation2(sequence, **kw) self.stepCreateOrganisation2(sequence, **kw)
self.stepCreateOrganisation3(sequence, **kw) self.stepCreateOrganisation3(sequence, **kw)
sequence.edit(vendor=sequence.get('organisation1')) vendor = sequence.get('organisation1')
vendor.setRegion(self.default_region)
vendor.validate()
sequence.edit(vendor=vendor)
client1 = sequence.get('organisation2') client1 = sequence.get('organisation2')
client1.setRegion(self.default_region) client1.setRegion(self.default_region)
self.assertNotEquals(client1.getRegionValue(), None) self.assertNotEquals(client1.getRegionValue(), None)
client1.validate()
sequence.edit(client1=client1) sequence.edit(client1=client1)
client2 = sequence.get('organisation3') client2 = sequence.get('organisation3')
self.assertEquals(client2.getRegionValue(), None) self.assertEquals(client2.getRegionValue(), None)
client2.validate()
sequence.edit(client2=client2) sequence.edit(client2=client2)
def stepCreateCurrency(self, sequence, **kw) : def stepCreateCurrency(self, sequence, **kw) :
...@@ -168,10 +173,12 @@ class TestInvoice(TestPackingListMixin, ...@@ -168,10 +173,12 @@ class TestInvoice(TestPackingListMixin,
"""Create the rule for accounting. """ """Create the rule for accounting. """
portal = self.getPortal() portal = self.getPortal()
account_module = self.getAccountModule() account_module = self.getAccountModule()
for account_id, account_gap in self.account_definition_list: for account_id, account_gap, account_type \
in self.account_definition_list:
if not account_id in account_module.objectIds(): if not account_id in account_module.objectIds():
account = account_module.newContent(id=account_id) account = account_module.newContent(id=account_id)
account.setGap(account_gap) account.setGap(account_gap)
account.setAccountType(account_type)
portal.portal_workflow.doActionFor(account, portal.portal_workflow.doActionFor(account,
'validate_action', wf_id='account_workflow') 'validate_action', wf_id='account_workflow')
invoice_rule = self.getPortal().portal_rules\ invoice_rule = self.getPortal().portal_rules\
......
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