Commit 6937e860 authored by Łukasz Nowak's avatar Łukasz Nowak

Prepare Accounting Period for default organisation.

Test reached accounting operations, and for those, accounting periods have to
be started.

Make them for two years, as lot of accounting operations can be done in year
of test and following year.
parent cfae4930
...@@ -31,6 +31,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase ...@@ -31,6 +31,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.utils import DummyMailHost from Products.ERP5Type.tests.utils import DummyMailHost
import os import os
from DateTime import DateTime
REQUIRED_NOTIFICATION_MESSAGE_REFERENCE_LIST = [ REQUIRED_NOTIFICATION_MESSAGE_REFERENCE_LIST = [
'crendential_request-confirmation-without-password', 'crendential_request-confirmation-without-password',
...@@ -229,6 +230,25 @@ class testVifibMixin(ERP5TypeTestCase): ...@@ -229,6 +230,25 @@ class testVifibMixin(ERP5TypeTestCase):
if isTransitionPossible(assignment, 'open'): if isTransitionPossible(assignment, 'open'):
assignment.open() assignment.open()
def prepareVifibAccountingPeriod(self):
vifib = self.portal.organisation_module['vifib_internet']
year = DateTime().year()
start_date = '%s/01/01' % year
stop_date = '%s/12/31' % (year + 1)
accounting_period = self.portal.portal_catalog.getResultValue(
portal_type='Accounting Period',
parent_uid=vifib.getUid(),
simulation_state='started',
**{
'delivery.start_date': start_date,
'delivery.stop_date': stop_date
}
)
if accounting_period is None:
accounting_period = vifib.newContent(portal_type='Accounting Period',
start_date=start_date, stop_date=stop_date)
accounting_period.start()
def prepareTestServices(self): def prepareTestServices(self):
isTransitionPossible = self.portal.portal_workflow.isTransitionPossible isTransitionPossible = self.portal.portal_workflow.isTransitionPossible
for service in self.portal.portal_catalog( for service in self.portal.portal_catalog(
...@@ -303,6 +323,7 @@ class testVifibMixin(ERP5TypeTestCase): ...@@ -303,6 +323,7 @@ class testVifibMixin(ERP5TypeTestCase):
self.setSystemPreference() self.setSystemPreference()
self.setupNotificationModule() self.setupNotificationModule()
self.prepareTestUsers() self.prepareTestUsers()
self.prepareVifibAccountingPeriod()
self.prepareTestServices() self.prepareTestServices()
transaction.commit() transaction.commit()
self.tic() self.tic()
......
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