Commit 1e7aabae by Roque

erp5_project: fixing project state domain

1 parent 3e690ecc
request = context.REQUEST
domain_list = []
closed_state_list = ['draft', 'invalidated', 'suspended']
category_list = []
if depth == 0:
category_list = [x for x in context.portal_catalog(portal_type='Project',
validation_state= closed_state_list)]
#validation_state='validated')]
else:
parent_object = context.restrictedTraverse(parent.parent_url)
category_list = parent_object.contentValues(portal_type='Project Line', sort_on='int_index')
for category in category_list:
domain = parent.generateTempDomain(id='sub%s' % category.getId())
membership_criterion_category = []
sub_category_list = [category]
while sub_category_list:
sub_category = sub_category_list.pop()
membership_criterion_category.append('source_project/%s/' % sub_category.getRelativeUrl())
sub_category_list.extend(sub_category.contentValues(portal_type='Project Line'))
domain.edit(title = category.getTitle(),
membership_criterion_base_category = ('source_project', ),
membership_criterion_category = membership_criterion_category,
domain_generator_method_id = script.id,
parent_url=category.getRelativeUrl(),
uid = category.getUid())
domain_list.append(domain)
return domain_list
request = context.REQUEST
domain_list = []
category_list = []
if depth == 0:
category_list = [x for x in context.portal_catalog(portal_type='Project',
validation_state='validated')]
else:
parent_object = context.restrictedTraverse(parent.parent_url)
category_list = parent_object.contentValues(portal_type='Project Line', sort_on='int_index')
for category in category_list:
domain = parent.generateTempDomain(id='sub%s' % category.getId())
membership_criterion_category = []
sub_category_list = [category]
while sub_category_list:
sub_category = sub_category_list.pop()
membership_criterion_category.append('source_project/%s/' % sub_category.getRelativeUrl())
sub_category_list.extend(sub_category.contentValues(portal_type='Project Line'))
domain.edit(title = category.getTitle(),
membership_criterion_base_category = ('source_project', ),
membership_criterion_category = membership_criterion_category,
domain_generator_method_id = script.id,
parent_url=category.getRelativeUrl(),
uid = category.getUid())
domain_list.append(domain)
return domain_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>depth, parent, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_generateStartedProjectDomain</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
domain_list = []
started_domain = parent.generateTempDomain(id='started')
started_domain.edit(title="Started",
criterion_property_list=['validation_state'])
started_domain.setCriterion('validation_state', identity='validated')
domain_list.append(started_domain)
not_started_domain = parent.generateTempDomain(id='not_started')
not_started_domain.edit(title="Not Started",
criterion_property_list=['validation_state'],
identity_criterion=dict(validation_state=('invalidated')))
not_started_domain.setCriterion('validation_state', identity=['draft', 'invalidated', 'suspended'])
domain_list.append(not_started_domain)
return domain_list
......@@ -54,7 +54,7 @@
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_generateClosedProjectDomain</string> </value>
<value> <string>Base_generateStateProjectDomain</string> </value>
</item>
</dictionary>
</pickle>
......
......@@ -140,12 +140,8 @@
<value>
<list>
<tuple>
<string>started_project_domain</string>
<string>Open Projects</string>
</tuple>
<tuple>
<string>closed_project_domain</string>
<string>Closed Projects</string>
<string>state_project_domain</string>
<string>Project State</string>
</tuple>
</list>
</value>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!