Commit 8914323f authored by Romain Courteaud's avatar Romain Courteaud

slapos_panel: only show allocable Software Product when requesting

parent e6cac460
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>text</string> </key> <key> <string>text</string> </key>
<value> <string>python: context.Base_hasSlapOSProjectUserGroup(manager=True, agent=True, customer=True)</string> </value> <value> <string>python: context.Base_hasSlapOSProjectUserGroup(customer=True)</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
project = context
portal = project.getPortalObject()
software_product_list = portal.portal_catalog(
portal_type='Software Product',
follow_up__uid=context.getUid(),
validation_state=['validated', 'published']
)
if project.getDestinationSection(None) is None:
# User virtual master
# No need to pay anything for the instance
# XXX filter by Allocation Supply
return software_product_list
result_list = []
for software_product in software_product_list:
# XXX be careful not acquiring categories from parent
movement = project.getParentValue().newContent(
#portal_type='Open Sale Order Line',
portal_type='Sale Order Line',
temp_object=True,
id=project.getId(),
uid=project.getUid(),
quantity=1,
#source=project.getSource(),
#source_section=project.getSourceSection(),
#destination=project.getDestination(),
#destination_section=project.getDestinationSection(),
#destination_project_value=project,
resource_value=software_product,
)
if movement.getPrice() is not None:
result_list.append(movement)
movement.setTitle('%s %s' % (software_product.getTitle(), movement.getPrice()))
return result_list
#return [x.asContext(title='%s %s' % (x.getTitle(), x.getPrice())) for x in software_product_list if x.getPrice(None) is not None]
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Project_getProductList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: [(x.getTitle(), x.getUid()) for x in context.getPortalObject().portal_catalog(portal_type=\'Software Product\', follow_up__uid=context.getUid(), validation_state=[\'validated\', \'published\'])]</string> </value> <value> <string>python: [(x.getTitle(), x.getUid()) for x in context.Project_getProductList()]</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
<dictionary> <dictionary>
<item> <item>
<key> <string>_text</string> </key> <key> <string>_text</string> </key>
<value> <string>python: [(x.getTitle(), x.getUrlString()) for x in context.getPortalObject().portal_catalog(portal_type=\'Software Release\', follow_up__uid=context.getUid(), aggregate__uid=request.get(\'field_your_aggregate_uid\'), validation_state=[\'shared\', \'shared_alive\', \'released\', \'released_alive\', \'published\', \'published_alive\'])]</string> </value> <value> <string>python: [(x.getTitle(x.getUrlString()), x.getUrlString()) for x in context.getPortalObject().portal_catalog(portal_type=\'Software Product Release Variation\', parent_uid=request.get(\'field_your_aggregate_uid\'))]</string> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
......
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