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

base: only consider open assignment to initialize preferences

parent 40d752f4
Pipeline #38538 failed with stage
in 0 seconds
...@@ -19,6 +19,8 @@ preference.setTitle(translateString('Preference for ${name}', ...@@ -19,6 +19,8 @@ preference.setTitle(translateString('Preference for ${name}',
mapping=dict(name=context.getTitle()))) mapping=dict(name=context.getTitle())))
for assignment in context.contentValues(portal_type='Assignment'): for assignment in context.contentValues(portal_type='Assignment'):
if assignment.getValidationState() != 'open':
continue
group = assignment.getGroup(base=True) group = assignment.getGroup(base=True)
if group: if group:
preference.setPreferredSectionCategory(group) preference.setPreferredSectionCategory(group)
......
...@@ -1309,6 +1309,12 @@ class TestERP5Base(ERP5TypeTestCase): ...@@ -1309,6 +1309,12 @@ class TestERP5Base(ERP5TypeTestCase):
site='distibution/tokyo') site='distibution/tokyo')
self.assertNotEqual(None, assignment.getGroupValue()) self.assertNotEqual(None, assignment.getGroupValue())
assignment.open() assignment.open()
# unrelated assignment that should be ignored
person.newContent(
portal_type='Assignment',
group='nexedi/rentalinux',
site='distibution/new_york',
)
login = person.newContent( login = person.newContent(
portal_type="ERP5 Login", portal_type="ERP5 Login",
reference="user_login", reference="user_login",
......
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