Commit 8cc80549 authored by Jérome Perrin's avatar Jérome Perrin

Don't assume that we'll have organisation_module/my_organisation and

portal_preferences/accounting_zuite_preference installed paths, this way we can
reuse AccountingTestCase without erp5_accounting_ui_test



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20849 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 21fff139
...@@ -168,7 +168,8 @@ class AccountingTestCase(ERP5TypeTestCase): ...@@ -168,7 +168,8 @@ class AccountingTestCase(ERP5TypeTestCase):
self.organisation_module = self.portal.organisation_module self.organisation_module = self.portal.organisation_module
self.person_module = self.portal.person_module self.person_module = self.portal.person_module
self.currency_module = self.portal.currency_module self.currency_module = self.portal.currency_module
self.section = self.organisation_module.my_organisation if not hasattr(self, 'section'):
self.section = getattr(self.organisation_module, 'my_organisation', None)
# make sure documents are validated # make sure documents are validated
for module in (self.account_module, self.organisation_module, for module in (self.account_module, self.organisation_module,
...@@ -177,12 +178,14 @@ class AccountingTestCase(ERP5TypeTestCase): ...@@ -177,12 +178,14 @@ class AccountingTestCase(ERP5TypeTestCase):
doc.validate() doc.validate()
# and the preference enabled # and the preference enabled
pref = self.portal.portal_preferences.accounting_zuite_preference pref = self.portal.portal_preferences._getOb(
pref.manage_addLocalRoles(self.username, ('Auditor', )) 'accounting_zuite_preference', None)
# Make sure _aq_dynamic is called before calling the workflow method if pref is not None:
# otherwise .enable might not been wrapped yet. This happen in --load pref.manage_addLocalRoles(self.username, ('Auditor', ))
pref._aq_dynamic('hack') # Make sure _aq_dynamic is called before calling the workflow method
pref.enable() # otherwise .enable might not been wrapped yet. This happen in --load
pref._aq_dynamic('hack')
pref.enable()
# and all this available to catalog # and all this available to catalog
get_transaction().commit() get_transaction().commit()
...@@ -201,8 +204,9 @@ class AccountingTestCase(ERP5TypeTestCase): ...@@ -201,8 +204,9 @@ class AccountingTestCase(ERP5TypeTestCase):
self.organisation_module.manage_delObjects([x for x in self.organisation_module.manage_delObjects([x for x in
self.accounting_module.objectIds() if x not in organisation_list]) self.accounting_module.objectIds() if x not in organisation_list])
for organisation_id in organisation_list: for organisation_id in organisation_list:
organisation = self.organisation_module._getOb(organisation_id) organisation = self.organisation_module._getOb(organisation_id, None)
organisation.manage_delObjects([x.getId() for x in if organisation is not None:
organisation.manage_delObjects([x.getId() for x in
organisation.objectValues( organisation.objectValues(
portal_type=('Accounting Period', 'Bank Account'))]) portal_type=('Accounting Period', 'Bank Account'))])
self.person_module.manage_delObjects([x for x in self.person_module.manage_delObjects([x for x in
......
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