Commit cf212c64 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Included jump between Subscription and Aggregated Packing Lists

   This makes management easier.
parent 019f4001
Pipeline #14782 failed with stage
in 0 seconds
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_related_aggregated_packing_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>8.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Related Aggregated Sale Packing List</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SalePackingList_jumpToRelatedAggregatedSalePackingList</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>python: [ x.getGroupingReference() for x in context.objectValues() if x.getGroupingReference() is not None]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>action_type/object_jio_jump</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_jump</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>jump_related_grouped_sale_packing_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>8.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Related Grouped Sale Packing List Lines</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/SalePackingList_jumpToRelatedGroupedSalePackingList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
grouping_reference = [ x.getGroupingReference() for x in context.objectValues() if x.getGroupingReference() is not None]
assert len(grouping_reference) in [0, 1], "Too many grouping references"
if not grouping_reference:
return context.Base_redirect(
"view", keep_items={
"portal_status_message": context.Base_translateString("No Packing List related.")}
)
aggregated_spl_list = context.getPortalObject().portal_catalog.getResultValue(
portal_type="Sale Packing List",
reference=grouping_reference)
if not aggregated_spl_list:
return context.Base_redirect(
"view", keep_items={
"portal_status_message": context.Base_translateString("No Packing List related.")}
)
return aggregated_spl_list.Base_redirect(
"view", keep_items={
"portal_status_message": context.Base_translateString("Related Sale Packing List Grouped")}
)
<?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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_jumpToRelatedAggregatedSalePackingList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
business_process_uid_list = [
portal.business_process_module.slapos_subscription_business_process.getUid()]
subscription_delivery_specialise_uid_list = [q.getUid() for q in portal.portal_catalog(
specialise_uid=business_process_uid_list, portal_type='Sale Trade Condition')]
search_kw = {
'portal_type': 'Sale Packing List Line',
'simulation_state': 'delivered',
# Default Aggregate UID to the hosting subscription?
"parent_specialise_uid": subscription_delivery_specialise_uid_list,
'grouping_reference' : context.getReference()}
related_line_list = portal.portal_catalog(**search_kw)
if len(related_line_list) == 0:
return context.Base_redirect(
"view", keep_items={
"portal_status_message": context.Base_translateString("No Packing List related.")}
)
elif len(related_line_list) == 1:
related_line_list[0].Base_redirect(
"view", keep_items={
"portal_status_message": context.Base_translateString("Related Grouped Sale Packing List")}
)
else:
selection_uid_list = [x.getUid() for x in related_line_list]
message = context.Base_translateString(
"Documents related to %s." % context.getPortalType(),
# if not found, fallback to generic translation
default=context.Base_translateString('Documents related to ${that_portal_type} : ${that_title}.',
mapping={"that_portal_type": context.getTranslatedPortalType(),
"that_title": context.getTitleOrId() }),)
return context.Base_redirect("Base_jumpToRelatedObjectList",
keep_items=dict(reset=1,
uid=selection_uid_list,
portal_status_message=message))
<?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>**kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SalePackingList_jumpToRelatedGroupedSalePackingList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -12,6 +12,8 @@ Person | create_new_cloud_contract
Person | jump_to_cloud_contract
Root Applied Rule Causality Causality Movement Group | view
Sale Invoice Transaction | create_slapos_reversal
Sale Packing List | jump_related_aggregated_packing_list
Sale Packing List | jump_related_grouped_sale_packing_list
SlapOS Accounting Quantity Updating Order Builder | view
SlapOS Accounting Quantity Updating Order Builder | view_predicate_group
SlapOS Accounting Quantity Updating Order Builder | view_profile
......
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