Commit a7a7d7c3 authored by Jérome Perrin's avatar Jérome Perrin

base: initialize site when creating user preferences

same as group
parent 25d831a0
......@@ -23,5 +23,8 @@ for assignment in context.contentValues(portal_type='Assignment'):
if group:
preference.setPreferredSectionCategory(group)
preference.setPreferredAccountingTransactionSectionCategory(group)
site = assignment.getSite(base=True)
if site:
preference.setPreferredNodeCategory(site)
return preference
......@@ -1153,7 +1153,8 @@ class TestERP5Base(ERP5TypeTestCase):
def test_user_creation(self):
person = self.portal.person_module.newContent(portal_type='Person')
assignment = person.newContent(portal_type='Assignment',
group='nexedi/storever')
group='nexedi/storever',
site='distibution/tokyo')
self.assertNotEquals(None, assignment.getGroupValue())
assignment.open()
self.portal.portal_workflow.doActionFor(person, 'create_user_action',
......@@ -1182,6 +1183,9 @@ class TestERP5Base(ERP5TypeTestCase):
# for his assignment group
self.assertEqual('group/nexedi/storever',
self.portal.portal_preferences.getPreferredSectionCategory())
# and assignment function
self.assertEqual('site/distibution/tokyo',
self.portal.portal_preferences.getPreferredNodeCategory())
def test_default_address_acquisition(self):
# more complete version of test_04_SubordinationAndAddress
......
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