Error occurred when fetching sidebar data
Various improvements
destination_decision=tmp_sale_order.getDestinationDecision(), | |||
destination_project=tmp_sale_order.getDestinationProject(), | |||
payment_mode=payment_mode, | |||
ledger_value=ledger_relative_url, | |||
ledger=ledger_relative_url, | |||
resource=tmp_sale_order.getPriceCurrency(), | |||
created_by_builder=1, # XXX this prevent init script from creating lines. | |||
activate_kw=activate_kw | |||
<?xml version="1.0"?> | |||
<ZopeData> | |||
<record id="1" aka="AAAAAAAAAAE="> | |||
<pickle> | |||
<global name="Alarm" module="erp5.portal_type"/> | |||
</pickle> | |||
<pickle> | |||
<dictionary> | |||
<item> | |||
<key> <string>active_sense_method_id</string> </key> | |||
<value> <string>Alarm_createMissingSubscriptionAssignment</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>automatic_solve</string> </key> | |||
<value> <int>0</int> </value> | |||
</item> | |||
<item> | |||
<key> <string>description</string> </key> | |||
<value> | |||
<none/> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>enabled</string> </key> | |||
<value> <int>1</int> </value> | |||
</item> | |||
<item> | |||
<key> <string>id</string> </key> | |||
<value> <string>slapos_cloud_create_missing_subscription_assignment</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>periodicity_day_frequency</string> </key> | |||
<value> <int>1</int> </value> | |||
</item> | |||
<item> | |||
<key> <string>periodicity_hour</string> </key> | |||
<value> | |||
<tuple/> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>periodicity_minute</string> </key> | |||
<value> | |||
<tuple/> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>periodicity_month</string> </key> | |||
<value> | |||
<tuple/> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>periodicity_month_day</string> </key> | |||
<value> | |||
<tuple/> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>periodicity_week</string> </key> | |||
<value> | |||
<tuple/> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>title</string> </key> | |||
<value> <string>Create Missing Subscription Assignment</string> </value> | |||
</item> | |||
</dictionary> | |||
</pickle> | |||
</record> | |||
</ZopeData> |
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>_local_properties</string> </key> | |||
<value> | |||
<tuple> | |||
<dictionary> | |||
<item> | |||
<key> <string>id</string> </key> | |||
<value> <string>message_property_not_set</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>type</string> </key> | |||
<value> <string>string</string> </value> | |||
</item> | |||
</dictionary> | |||
</tuple> | |||
</value> | |||
</item> | |||
<item> | |||
<key> <string>_range_criterion</string> </key> | |||
<value> | |||
<value> | |||
<tuple> | |||
<string>source_reference</string> | |||
<string>text_content</string> | |||
</tuple> | |||
</value> | |||
</item> | |||
<key> <string>message_no_such_property</string> </key> | |||
<value> <string>Property existence error for property ${property_id}, this document has no such property or the property has never been set</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>message_property_not_set</string> </key> | |||
<value> <string>Property existence error for property ${property_id}, this document has no such property or the property has never been set</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>portal_type</string> </key> | |||
<value> <string>Property Existence Constraint</string> </value> | |||
portal = context.getPortalObject() | |||
assignment_category_list = portal.portal_preferences.getPreferredSubscriptionAssignmentCategoryList() | |||
is_default_project_defined = False | |||
for assignment_category in assignment_category_list: | |||
if assignment_category.startswith('destination_project/project_module/'): | |||
is_default_project_defined = True | |||
if not is_default_project_defined: | |||
return | |||
portal.portal_catalog.searchAndActivate( | |||
portal_type='Assignment', | |||
# Do not create assignment if the Person does not have at least one | |||
validation_state='open', | |||
# Prevent checking the same person multiple times | |||
group_by=['parent_uid'], | |||
method_id='Assignment_createPersonMissingSubscriptionAssignment', | |||
# This alarm bruteforce checking all documents, | |||
# without changing them directly. | |||
# Increase priority to not block other activities | |||
method_args=[assignment_category_list], | |||
method_kw={"activate_kw": {'tag': tag, 'priority': 2}}, | |||
activate_kw={'tag': tag, 'priority': 2} | |||
) | |||
context.activate(after_tag=tag).getId() |
<?xml version="1.0"?> | |||
<ZopeData> | |||
<record id="1" aka="AAAAAAAAAAE="> | |||
<pickle> | |||
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/> | |||
</pickle> | |||
<pickle> | |||
<dictionary> | |||
<item> | |||
<key> <string>_bind_names</string> </key> | |||
<value> | |||
<object> | |||
<klass> | |||
<global name="_reconstructor" module="copy_reg"/> | |||
</klass> | |||
<tuple> | |||
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> | |||
<global name="object" module="__builtin__"/> | |||
<none/> | |||
</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>tag, fixit, params</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>id</string> </key> | |||
<value> <string>Alarm_createMissingSubscriptionAssignment</string> </value> | |||
</item> | |||
</dictionary> | |||
</pickle> | |||
</record> | |||
</ZopeData> |
from zExceptions import Unauthorized | |||
if REQUEST is not None: | |||
raise Unauthorized | |||
assignment_category_set = set(assignment_category_list) | |||
person = context.getParentValue() | |||
# check if user has an assignment matching the default preference | |||
has_default_assignment = False | |||
has_open_assignment = False | |||
for assignment in person.contentValues( | |||
portal_type='Assignment' | |||
): | |||
if assignment.getValidationState() != 'open': | |||
continue | |||
has_open_assignment = True | |||
has_default_assignment = has_default_assignment or (assignment_category_set <= set(assignment.getCategoryList())) | |||
if has_open_assignment and (not has_default_assignment): | |||
new_assignment = person.newContent( | |||
portal_type="Assignment", | |||
title="Preferred Subscription Assignment" | |||
) | |||
new_assignment.setCategoryList(assignment_category_list) | |||
new_assignment.open(comment="Created during the system preference subscription definition") | |||
new_assignment.reindexObject(activate_kw=activate_kw) |
<?xml version="1.0"?> | |||
<ZopeData> | |||
<record id="1" aka="AAAAAAAAAAE="> | |||
<pickle> | |||
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/> | |||
</pickle> | |||
<pickle> | |||
<dictionary> | |||
<item> | |||
<key> <string>_bind_names</string> </key> | |||
<value> | |||
<object> | |||
<klass> | |||
<global name="_reconstructor" module="copy_reg"/> | |||
</klass> | |||
<tuple> | |||
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> | |||
<global name="object" module="__builtin__"/> | |||
<none/> | |||
</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>assignment_category_list, activate_kw=None, REQUEST=None</string> </value> | |||
</item> | |||
<item> | |||
<key> <string>id</string> </key> | |||
<value> <string>Assignment_createPersonMissingSubscriptionAssignment</string> </value> | |||
</item> | |||
</dictionary> | |||
</pickle> | |||
</record> | |||
</ZopeData> |
acl_users/slapos_shadow | |||
portal_alarms/slapos_allocate_instance | |||
portal_alarms/slapos_assert_instance_tree_successor | |||
portal_alarms/slapos_cloud_create_missing_subscription_assignment | |||
portal_alarms/slapos_cloud_garbage_collect_one_time_virtual_master_access_token | |||
portal_alarms/slapos_cloud_invalidate_closed_compute_node | |||
portal_alarms/slapos_cloud_invalidate_destroyed_instance | |||