Commit 41d86ad0 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: drop unused scripts

parent d9461ebe
<?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_action</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_action</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>notify_active_subscriber_list</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>10.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Notify Active Subscribers</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}/SubscriptionRequestModule_viewNotifyActiveSubscriberListDialog</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_button</string>
</tuple>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_jio_button</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>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>rss_view</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Action Information</string> </value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>30.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>RSS Feed</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}/SubscriptionRequestModule_viewFeedURLDialog</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>string:rss_feed_image</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>invitation_token=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Person_applyContractInvitation</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from DateTime import DateTime
portal = context.getPortalObject()
# Notify users with active instances.
ticket_list = []
person_notification_list = []
for subscription_request in portal.subscription_request_module.searchFolder(
portal_type="Subscription Request"):
instance_tree = subscription_request.getAggregateValue()
if instance_tree is None or \
instance_tree.getSlapState() == "destroy_requested":
continue
person_notification_list.append(subscription_request.getDestinationSectionValue())
for destination_decision_value in list(set(person_notification_list)):
support_request_in_progress = portal.portal_catalog.getResultValue(
portal_type = 'Support Request',
title = title,
simulation_state = ["validated", "submitted", "suspended"],
default_destination_decision_uid = destination_decision_value.getUid())
if support_request_in_progress is not None:
return support_request_in_progress
support_request_in_progress = context.REQUEST.get(
"support_request_in_progress_%s" % destination_decision_value.getUid(), None)
if support_request_in_progress is not None:
raise ValueError("There is one ticket in progress for the %s: %s" %
(destination_decision_value.getRelativeUrl(),
support_request_in_progress))
# This might be a bit hard to keep the usage of the template since
# we could like to make ticket portal type selectable.
ticket = portal.restrictedTraverse(
portal.portal_preferences.getPreferredSupportRequestTemplate())\
.Base_createCloneDocument(batch_mode=1)
ticket.edit(
title = title,
description=text_content,
start_date = start_date,
destination_decision_value=destination_decision_value,
source=source,
resource=resource)
# Keep on draft for review before send
if simulation_state == "validated":
ticket.validate()
elif simulation_state == "invalidated":
ticket.validate()
ticket.invalidate()
elif simulation_state == "suspended":
ticket.validate()
ticket.suspend()
context.REQUEST.set(
"support_request_in_progress_%s" % destination_decision_value.getUid(),
ticket.getRelativeUrl())
event = portal.event_module.newContent(
portal_type=portal_type)
ticket.edit(causality_value=event)
# Copy original post into the original message.
event.edit(
title=ticket.getTitle(),
text_content=text_content,
source=source,
destination=ticket.getDestinationDecision())
# Move state before setFollowUp
if send_event:
event.start(comment="Automatic sending notification for the subscriber")
else:
event.plan(comment="Planned to send later")
ticket_list.append(ticket)
if ticket_list:
return ticket.getParentValue().Base_redirect(
keep_items={"portal_message_status": "Ticket Created.",
"uid": [i.getUid() for i in ticket_list]})
return context.Base_redirect(
keep_items={"portal_message_status": "No Ticket Created."})
<?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>source, resource, title, text_content, simulation_state, send_event=False, portal_type="", start_date=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequestModule_notifyActiveSubscriberList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from zExceptions import Unauthorized
from DateTime import DateTime
if REQUEST is not None:
raise Unauthorized
portal = context.getPortalObject()
web_site = context.getWebSiteValue()
if email in ["", None]:
error = "Email must be provided"
base_url = context.getWebSectionValue().absolute_url()
redirect_url = "%s?field_your_reservation_name=%s&field_your_reservation_email=%s&field_your_reservation_number_of_machines=%s&field_your_reservation_network=%s&field_your_reservation_invitation_token=%s&portal_status_message=%s" % (
base_url,
user_input_dict['name'],
email,
user_input_dict["amount"],
subscription_reference,
token,
error
)
return context.REQUEST.RESPONSE.redirect(redirect_url)
if token:
error = ""
try:
invitation_token = portal.invitation_token_module[token]
except KeyError:
error = context.Base_translateString("Token not Found")
else:
if invitation_token.getValidationState() != "validated":
error = "Token is invalid or it was already used"
if error:
base_url = context.getWebSectionValue().absolute_url()
redirect_url = "%s?field_your_reservation_name=%s&field_your_reservation_email=%s&field_your_reservation_number_of_machines=%s&field_your_reservation_network=%s&field_your_reservation_invitation_token=%s&portal_status_message=%s" % (
base_url,
user_input_dict['name'],
email,
user_input_dict["amount"],
subscription_reference,
token,
error
)
return context.REQUEST.RESPONSE.redirect(redirect_url)
# You always needs a user here
person, person_is_new = context.SubscriptionRequest_createUser(email, user_input_dict['name'])
# Check if user is already exist, otherwise redirect to ask confirmation
if confirmation_required and not person_is_new:
base_url = web_site.absolute_url()
redirect_url = "%s/order_confirmation?field_your_reservation_name=%s&field_your_reservation_email=%s&field_your_reservation_number_of_machines=%s&field_your_reservation_network=%s" % (
base_url,
person.getTitle(),
person.getDefaultEmailText(),
user_input_dict["amount"],
subscription_reference)
if token:
redirect_url += "&field_your_reservation_invitation_token=%s" % token
if variation_reference:
redirect_url += "&field_your_variation_reference=%s" % variation_reference
return context.REQUEST.RESPONSE.redirect(redirect_url)
if target_language is None:
target_language = portal.Localizer.get_selected_language()
contract = None
if token:
contract = person.Person_applyContractInvitation(invitation_token)
subscription_condition = context.portal_catalog.getResultValue(
portal_type="Subscription Condition",
reference=subscription_reference if (target_language != "zh") else (subscription_reference + '_zh'),
validation_state="validated"
)
subscription_request = context.subscription_request_module.newContent(
portal_type="Subscription Request",
destination_section_value=person,
quantity=user_input_dict["amount"],
language=target_language,
specialise_value=subscription_condition,
source_project_value=subscription_condition.getFollowUpValue()
)
subscription_request.setDefaultEmailText(email)
def wrapWithShadow(subscription_request,
subscription_request_id, variation_reference, contract=contract):
subscription_request.activate(tag="subscription_condition_%s" % subscription_request_id
).SubscriptionRequest_applyCondition()
return subscription_request.SubscriptionRequest_requestPaymentTransaction(
tag="subscription_%s" % subscription_request_id,
contract=contract,
variation_reference=variation_reference
)
payment = person.Person_restrictMethodAsShadowUser(
shadow_document=person,
callable_object=wrapWithShadow,
argument_list=[subscription_request,
subscription_request.getId(),
variation_reference, contract])
# Ensure tests crashes in batch mode
assert payment.getPaymentMode() in ['payzen', 'wechat']
if batch_mode:
return {'subscription' : subscription_request.getRelativeUrl(),
'payment': payment.getRelativeUrl() }
def wrapRedirectWithShadow(payment_transaction, web_site):
# getTotalPayble returns a negative value
if payment_transaction.PaymentTransaction_getTotalPayablePrice() < 0:
if payment.getPaymentMode() == 'wechat':
return payment_transaction.PaymentTransaction_redirectToManualWechatPayment(web_site)
elif payment.getPaymentMode() == 'payzen':
return payment_transaction.PaymentTransaction_redirectToManualPayzenPayment(web_site)
else:
raise NotImplementedError('Not supported payment mode (%s) for %s' % (payment.getPaymentMode(), payment.getRelativeUrl()))
return payment_transaction.PaymentTransaction_redirectToManualFreePayment(web_site)
return person.Person_restrictMethodAsShadowUser(
shadow_document=person,
callable_object=wrapRedirectWithShadow,
argument_list=[payment, web_site])
<?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>email, subscription_reference, confirmation_required=False, token=None, user_input_dict=None, variation_reference=None, target_language=None, batch_mode=True, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequestModule_requestSubscriptionProxy</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ERP5 Form" module="erp5.portal_type"/>
</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/>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>action</string> </key>
<value> <string>SubscriptionRequestModule_notifyActiveSubscriberList</string> </value>
</item>
<item>
<key> <string>action_title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Use this dialog to create a new event and associate it to a Ticket.</string> </value>
</item>
<item>
<key> <string>edit_order</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>enctype</string> </key>
<value> <string>multipart/form-data</string> </value>
</item>
<item>
<key> <string>group_list</string> </key>
<value>
<list>
<string>left</string>
<string>right</string>
<string>center</string>
<string>bottom</string>
<string>hidden</string>
</list>
</value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<dictionary>
<item>
<key> <string>bottom</string> </key>
<value>
<list>
<string>your_text_content</string>
</list>
</value>
</item>
<item>
<key> <string>center</string> </key>
<value>
<list>
<string>your_content_type</string>
</list>
</value>
</item>
<item>
<key> <string>hidden</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>left</string> </key>
<value>
<list>
<string>your_title</string>
<string>your_portal_type</string>
<string>your_resource</string>
<string>your_start_date</string>
</list>
</value>
</item>
<item>
<key> <string>right</string> </key>
<value>
<list>
<string>your_source</string>
<string>your_simulation_state</string>
</list>
</value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequestModule_viewNotifyActiveSubscriberListDialog</string> </value>
</item>
<item>
<key> <string>method</string> </key>
<value> <string>POST</string> </value>
</item>
<item>
<key> <string>name</string> </key>
<value> <string>SubscriptionRequestModule_viewNotifyActiveSubscriberListDialog</string> </value>
</item>
<item>
<key> <string>pt</string> </key>
<value> <string>form_dialog</string> </value>
</item>
<item>
<key> <string>row_length</string> </key>
<value> <int>4</int> </value>
</item>
<item>
<key> <string>stored_encoding</string> </key>
<value> <string>UTF-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Create one Ticket Per Person</string> </value>
</item>
<item>
<key> <string>unicode_mode</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>update_action</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>update_action_title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>items</string>
<string>orientation</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_content_type</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_width</string> </key>
<value> <int>20</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_radio_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list>
<tuple>
<string>HTML</string>
<string>text/html</string>
</tuple>
<tuple>
<string>Plain Text</string>
<string>text/plain</string>
</tuple>
<tuple>
<string>reStructuredText</string>
<string>text/x-rst</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>orientation</string> </key>
<value> <string>horizontal</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Text Format</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.Ticket_getPreferredFollowUpEventContentType()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>items</string>
<string>required</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_portal_type</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Event Type</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.Ticket_getPreferredFollowUpEventPortalType()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(here.Localizer.erp5_ui.gettext(x), x) for x in here.getPortalEventTypeList()]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_resource</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Event Nature</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.Ticket_getResourceItemList(portal_type=\'Event\', include_context=False)</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>first_item</string>
<string>items</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_simulation_state</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list>
<tuple>
<string>Draft</string>
<string>draft</string>
</tuple>
<tuple>
<string>Open</string>
<string>validated</string>
</tuple>
<tuple>
<string>Closed</string>
<string>invalidated</string>
</tuple>
<tuple>
<string>Suspended</string>
<string>suspended</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Ticket State</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>first_item</string>
<string>items</string>
<string>required</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_source</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_list_field</string> </value>
</item>
<item>
<key> <string>first_item</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>items</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>required</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Sender or Caller</string> </value>
</item>
<item>
<key> <string>view_separator</string> </key>
<value> <string encoding="cdata"><![CDATA[
<br />
]]></string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.getPortalObject().restrictedTraverse(context.portal_preferences.getPreferredSupportRequestTemplate()).getSource()</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(context.getPortalObject().restrictedTraverse(context.portal_preferences.getPreferredSupportRequestTemplate()).getSourceTitle(), context.getPortalObject().restrictedTraverse(context.portal_preferences.getPreferredSupportRequestTemplate()).getSource())]</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default_now</string>
<string>editable</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_start_date</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default_now</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_event_start_date</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>default</string>
<string>editable</string>
<string>enabled</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_text_content</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>editable</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_text_content</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewCRMFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Message</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>string:</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>not: request/mass_workflow_action | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>your_title</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_string_field</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Title</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>not: request/mass_workflow_action | nothing</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
# Send an email for the user with a URL, so he can set the password.
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
reference = None
password = None
person = context.getDestinationSectionValue(portal_type="Person")
if person.getDefaultEmailText() is None:
person.setDefaultEmailText(context.getDefaultEmailText())
if person.getLanguage() in [None, ""]:
person.setLanguage(context.getLanguage())
# Should come from subscription condition probably or preference
function_list = ['customer']
open_assignment_list = person.searchFolder(portal_type="Assignment",
validation_state="open")
current_assignment_list = {}
for assignment in open_assignment_list:
function = assignment.getFunction()
if function in current_assignment_list:
current_assignment_list[function].append(assignment)
else:
current_assignment_list[function] = [assignment]
for function in function_list:
if function in current_assignment_list:
# Update assignment (Reset stop/start dates)
for assignment in current_assignment_list[function]:
if assignment.getStartDate() is None or \
assignment.getStopDate() is None:
assignment.update()
assignment.edit(stop_date=None,
start_date=None)
assignment.open(
comment="Start and Stop reset by Subscription Request")
else:
# Create assignment
assignment = person.newContent(
portal_type='Assignment',
title = '%s Assignment' % (function.capitalize()),
function = function,
destination_project=context.getSourceProject()
)
assignment.open(comment="Created by Subscription Request")
login_list = [x for x in person.objectValues(portal_type=['ERP5 Login', 'Google Login', 'Facebook Login']) \
if x.getValidationState() == 'validated']
if not login_list:
raise ValueError('Something is wrong')
login = login_list[0]
# Let's reset password if the user is his first login.
if not open_assignment_list and person.getUserId() == login_list[0].getReference():
login.invalidate()
login.setReference(person.getDefaultEmailText())
reference = person.getDefaultEmailText()
# Update password of the user
password = person.Person_generatePassword()
login.setPassword(password)
login.validate(comment="Updated by Subscription Request")
# Update Roles and Title
try:
person.validate()
except UnsupportedWorkflowMethod:
pass
context.activate(activity='SQLQueue').SubscriptionRequest_sendAcceptedNotification(reference, password)
context.order()
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_boostrapUserAccount</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
portal = context.getPortalObject()
current_invoice = context.getCausalityValue()
if current_invoice is None:
# _init is guarded by the owner role
# but SubscriptionRequest_createRelatedSaleInvoiceTransaction is called with a shadow user
# leading to unauthorized error
# Instead, clone one temp invoice (as there is no _afterClone)
invoice_template = portal.restrictedTraverse(template)
current_invoice = invoice_template.Base_createCloneDocument(batch_mode=1)
assert current_invoice is not None
current_invoice.manage_delObjects([x for x in
current_invoice.contentIds() if x != "1"])
current_invoice.edit(
categories=[],
title=None
)
current_invoice["1"].manage_delObjects([x for x in
current_invoice["1"].contentIds()])
current_invoice["1"].edit(
categories=[],
title=None,
quantity=None,
price=None,
base_unit_price=None,
#index=None,
#variation_base_category_list=None,
#variation_category_list=None,
)
current_invoice["1"].updateCellRange('movement')
context.edit(causality_value=current_invoice)
payment_transaction = portal.restrictedTraverse(payment)
current_invoice.edit(
title="Reservation Fee",
ledger_value=portal.portal_categories.ledger.automated,
source_project_value=context.getSourceProjectValue(),
destination_value=context.getDestinationSection(),
destination_section_value=context.getDestinationSection(),
destination_decision_value=context.getDestinationSection(),
start_date=payment_transaction.getStartDate(),
stop_date=payment_transaction.getStopDate(),
specialise=portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition(),
source_section_value=payment_transaction.getSourceSectionValue(),
source_value=payment_transaction.getSourceValue(),
payment_mode_value=payment_transaction.getPaymentModeValue(),
price_currency_value=payment_transaction.getPriceCurrencyValue(),
resource_value=payment_transaction.getResourceValue(),
)
current_invoice["1"].edit(
start_date=payment_transaction.getStartDate(),
stop_date=payment_transaction.getStopDate(),
use="trade/sale",
resource="service_module/slapos_reservation_fee_2",
quantity_unit="unit/piece",
base_contribution_list=[
"base_amount/invoicing/discounted",
"base_amount/invoicing/taxable"
],
quantity=context.getQuantity(),
price=price
)
comment = "Validation invoice for subscription request %s" % context.getRelativeUrl()
current_invoice.plan(comment=comment)
current_invoice.confirm(comment=comment)
current_invoice.startBuilding(comment=comment)
payment_transaction.setCausalityValue(current_invoice)
current_invoice.reindexObject(activate_kw={'tag': tag})
return current_invoice
<?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>price, tag, payment, template, service_variation, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_createRelatedSaleInvoiceTransaction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from zExceptions import Unauthorized
import random, string
if REQUEST is not None:
raise Unauthorized
portal = context.getPortalObject()
person = portal.portal_membership.getAuthenticatedMember().getUserValue()
if person is not None:
# Person already existed
return person, False
# Already has login with this.
person = context.SubscriptionRequest_searchExistingUserByEmail(email)
if person is not None:
return person, False
# Create a Person document in order to generate the invoice.
person = portal.person_module.newContent(
portal_type="Person",
first_name=name)
password = [random.choice(string.upper(string.ascii_letters)),
random.choice(string.lower(string.ascii_letters)),
random.choice(string.digits),
random.choice("$!*#%$.;:,")]
chars = string.ascii_letters + string.digits + '!@#$%^&*()'
password.extend([random.choice(chars) for _ in range(26)])
random.shuffle(password)
login = person.newContent(
portal_type="ERP5 Login",
reference=person.getUserId(),
password=''.join(password))
login.validate()
# The rest of the information will be used later.
person.SubscriptionRequest_saveTransactionalUser(person)
# New user is created
return person, True
<?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>email, name, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
<string>Owner</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_createUser</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
portal = context.getObject()
if context.REQUEST.get("refund_packing_list_%s" % context.getUid(),
None) is not None:
return
tag = "refund_packing_list_%s_inProfess" % context.getUid()
if (portal.portal_activities.countMessageWithTag(tag) > 0):
return
service = portal.restrictedTraverse(
"service_module/slapos_reservation_refund")
if len(portal.portal_catalog(
default_resource_uid=service.getUid(),
portal_type="Sale Packing List Line",
simulation_state="delivered",
parent_causality_uid=context.getUid())):
# Already generated
return
sale_invoice_transaction = context.getCausalityValue(
portal_type="Sale Invoice Transaction")
if sale_invoice_transaction is None or sale_invoice_transaction.getSimulationState() in ["draft", "cancelled", "deleted"]:
# No invoice generated, nothing to do
return
payment_transaction = sale_invoice_transaction.getCausalityRelatedValue(
portal_type="Payment Transaction")
if payment_transaction is None or payment_transaction.getSimulationState() != "stopped":
# Nothing to do bug wait the payment
return
price_without_tax = None
for invoice_line in sale_invoice_transaction.objectValues(portal_type="Invoice Line"):
# XXX
if invoice_line.getResource() == "service_module/slapos_reservation_fee_2":
price_without_tax = invoice_line.getTotalPrice()
assert price_without_tax is not None, "Something is wrong since price wasn't found"
# Time to create the PL
person = sale_invoice_transaction.getDestinationValue(portal_type="Person")
delivery_template = portal.restrictedTraverse(
portal.portal_preferences.getPreferredInstanceDeliveryTemplate())
delivery = delivery_template.Base_createCloneDocument(batch_mode=1)
delivery.edit(
title="Reservation Deduction",
specialise="sale_trade_condition_module/slapos_reservation_refund_trade_condition",
destination=person.getRelativeUrl(),
destination_decision=person.getRelativeUrl(),
start_date=payment_transaction.getCreationDate(),
causality_uid=context.getUid(),
price_currency=sale_invoice_transaction.getPriceCurrency(),
source=sale_invoice_transaction.getSource(),
source_section=sale_invoice_transaction.getSourceSection(),
ledger_value=portal.portal_categories.ledger.automated,
source_project_value=sale_invoice_transaction.getSourceProjectValue(),
)
line = delivery.newContent(
portal_type="Sale Packing List Line",
title="Reservation Deduction",
quantity=1,
destination_value=person,
destination_decision_value=person,
destination_section_value=person,
resource_value=service,
quantity_unit=service.getQuantityUnit(),
price=-price_without_tax,
causality_uid=context.getUid()
)
delivery.confirm(comment="Created from %s" % context.getRelativeUrl())
delivery.start()
delivery.stop()
delivery.deliver()
delivery.startBuilding()
delivery.reindexObject(activate_kw={'tag': tag})
line.reindexObject(activate_kw={'tag': tag})
context.REQUEST.set("refound_packing_list_%s" % context.getUid(),
delivery)
return delivery
<?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>REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_generateReservationRefoundSalePackingList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
if context.getSimulationState() != "confirmed":
return
instance_tree = context.getAggregateValue()
for instance in instance_tree.getSpecialiseRelatedValueList(portal_type="Software Instance"):
if (not instance.getAggregate()) or instance.SoftwareInstance_hasReportedError():
# Some instance still failing, so instance seems not ready yet.
return
# Instance is ok, we should move foward
portal = context.getPortalObject()
sender = context.getSourceSectionValue(portal_type="Person")
recipient = context.getDestinationSectionValue(portal_type="Person")
language = context.getLanguage(recipient.getLanguage())
# Get message from catalog
notification_reference = 'subscription_request-instance-is-ready'
notification_message = portal.portal_notifications.getDocumentValue(
reference=notification_reference, language=language)
if notification_message is None:
raise ValueError, 'Unable to found Notification Message with reference "%s".' % notification_reference
# Set notification mapping
notification_mapping_dict = {
'name': recipient.getTitle(),
'subscription_title': context.getTitle(),
'instance_tree_relative_url': instance_tree.getRelativeUrl()}
# Preserve HTML else convert to text
if notification_message.getContentType() == "text/html":
mail_text = notification_message.asEntireHTML(
substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict})
else:
mail_text = notification_message.asText(
substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict})
portal.portal_notifications.sendMessage(
sender=sender,
recipient=recipient,
subject=notification_message.getTitle(),
message=mail_text,
message_text_format=notification_message.getContentType(),
notifier_list=(portal.portal_preferences.getPreferredLoginAndPasswordNotifier(),),
store_as_event= portal.portal_preferences.isPreferredStoreEvents(),
event_keyword_argument_dict={'follow_up':context.getRelativeUrl()},
)
return True
<?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></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_notifyInstanceIsReady</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
if context.getSimulationState() != "ordered":
return
# Instance is ok, we should move foward
portal = context.getPortalObject()
sender = context.getSourceSectionValue(portal_type="Person")
recipient = context.getDestinationSectionValue(portal_type="Person")
# Get message from catalog
notification_reference = 'subscription_request-payment-is-ready'
language = context.getLanguage(recipient.getLanguage())
# This implies the language to notify.
notification_message = portal.portal_notifications.getDocumentValue(
reference=notification_reference, language=language)
if notification_message is None:
raise ValueError, 'Unable to found Notification Message with reference "%s".' % notification_reference
# Set notification mapping
notification_mapping_dict = {
'name': recipient.getTitle(),
'subscription_title': context.getTitle(),
# Possible more actions goes here
'payment_relative_relative_url': invoice.getRelativeUrl()}
# Preserve HTML else convert to text
if notification_message.getContentType() == "text/html":
mail_text = notification_message.asEntireHTML(
substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict})
else:
mail_text = notification_message.asText(
substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict})
portal.portal_notifications.sendMessage(
sender=sender,
recipient=recipient,
subject=notification_message.getTitle(),
message=mail_text,
message_text_format=notification_message.getContentType(),
notifier_list=(portal.portal_preferences.getPreferredLoginAndPasswordNotifier(),),
store_as_event= portal.portal_preferences.isPreferredStoreEvents(),
event_keyword_argument_dict={'follow_up':context.getRelativeUrl()},
)
return True
<?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>invoice</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_notifyPaymentIsReady</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
portal = context.getPortalObject()
current_invoice = context.getCausalityValue()
current_payment = None
service_variation = None
if current_invoice is None:
# PaymentTransaction_init is guarded by the owner role
# but SubscriptionRequest_requestPaymentTransaction is called with a shadow user
# leading to unauthorized error
# Instead, clone one temp payment (as there is no PaymentTransaction_afterClone)
payment_template = portal.restrictedTraverse(portal.portal_preferences.getPreferredDefaultPrePaymentTemplate())
current_payment = payment_template.Base_createCloneDocument(batch_mode=1)
assert current_payment is not None
current_payment.manage_delObjects([x for x in
current_payment.contentIds()])
current_payment.edit(
categories=[],
title=None
)
subscription_condition = context.getSpecialiseValue(portal_type='Subscription Condition')
trade_condition = subscription_condition.getSpecialiseValue(portal_type='Sale Trade Condition')
assert trade_condition is not None
# XXX if we have a tree of trade condition, getPaymentMode may be empty (if there is no acquisition)
payment_mode = trade_condition.getPaymentModeValue()
now = DateTime()
current_payment.edit(
title="Payment for Reservation Fee",
ledger_value=portal.portal_categories.ledger.automated,
source_project_value=context.getSourceProjectValue(),
specialise_value=trade_condition,
destination_value=context.getDestinationSection(),
destination_section_value=context.getDestinationSection(),
destination_decision_value=context.getDestinationSection(),
start_date=now,
stop_date=now,
payment_mode_uid=payment_mode.getUid(),
#source_payment_value=trade_condition.getSourcePaymentValue(),
#source_value=trade_condition.getSourceValue(),
#source_section_value=trade_condition.getSourceSectionValue(),
#price_currency_value=trade_condition.getPriceCurrencyValue(),
#resource=
)
current_payment.SaleOrder_applySaleTradeCondition(batch_mode=1, force=1)
current_payment.edit(
specialise_value=None,
)
# Search for matching resource
service = portal.portal_catalog(
# XXX Hardcoded as temporary
id='slapos_reservation_fee_2',
portal_type='Service',
validation_state='validated',
use__relative_url='use/trade/sale'
)[0].getObject()
if context.SubscriptionRequest_testSkippedReservationFree(contract):
# Reservation is Free
price = 0
tax = 0
else:
tmp_invoice = portal.accounting_module.newContent(
temp_object=True,
portal_type='Sale Invoice Transaction',
price_currency_value=trade_condition.getPriceCurrencyValue(),
specialise=portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition(),
)
tmp_invoice_line = tmp_invoice.newContent(
temp_object=True,
portal_type='Invoice Line',
resource_value=service,
quantity=context.getQuantity(),
quantity_unit=service.getQuantityUnit(),
base_contribution_list=service.getBaseContributionList(),
use=service.getUse(),
# Dates are required to correctly select the correct trade condition version (based on effective date)
start_date=now,
stop_date=now,
)
predicate_list = []
inherited_trade_condition = trade_condition
while inherited_trade_condition is not None:
predicate_list.extend([
x for x in inherited_trade_condition.contentValues(portal_type='Sale Supply Line')
if x.getResource() == service.getRelativeUrl()
])
inherited_trade_condition = inherited_trade_condition.getSpecialiseValue(portal_type=inherited_trade_condition.getPortalType())
price = service.getPrice(
context=tmp_invoice_line,
predicate_list=predicate_list,
default=None
)
if price is None:
raise NotImplementedError('Price must be defined')
# XXX calculate Tax
# We need to provide Price to pay right the way, so we need to include
# taxation at this point it is most liketly to quickly forecast price
# with taxes, but for now it is hardcoded.
tax = None
if 'base_amount/invoicing/taxable' in tmp_invoice_line.getBaseContributionList():
for trade_model_line in tmp_invoice_line.getAggregatedAmountList():
tax = trade_model_line.getPrice()
# For simplification consider tax is a single value.
break
if tax is None:
raise NotImplementedError('No tax trade model line found')
amount = context.getQuantity()
total = round((int(amount) * price)+(int(amount) * price*tax), 2)
current_payment.newContent(
portal_type="Accounting Transaction Line",
quantity=total,
destination="account_module/payable",
source="account_module/receivable",
)
current_payment.newContent(
portal_type="Accounting Transaction Line",
quantity=-total,
# XXX why source/destination are identical?
destination="account_module/payment_to_encash",
source="account_module/payment_to_encash",
)
# Accelarate job of alarms before proceed to payment.
comment = "Validation payment for subscription request %s" % context.getRelativeUrl()
current_payment.confirm(comment=comment)
current_payment.start(comment=comment)
if not price:
current_payment.stop(comment="%s (Free)" % comment)
elif current_payment.getPaymentMode() == "payzen":
# Payzen require update like this.
current_payment.PaymentTransaction_updateStatus()
current_payment.reindexObject(activate_kw={'tag': tag})
context.reindexObject(activate_kw={'tag': tag})
context.activate(tag=tag).SubscriptionRequest_createRelatedSaleInvoiceTransaction(
price, tag, current_payment.getRelativeUrl(), portal.portal_preferences.getPreferredDefaultPrePaymentSubscriptionInvoiceTemplate(),
service_variation)
return current_payment
<?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, contract=None, variation_reference=None, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_requestPaymentTransaction</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
portal = context.getPortalObject()
sender = context.getSourceSectionValue(portal_type="Person")
recipient = context.getDestinationSectionValue(portal_type="Person")
#Define the type of notification
notification_type = "without-password"
if password:
notification_type = "with-password"
language = context.getLanguage(recipient.getLanguage())
#Get message from catalog
notification_reference = 'subscription_request-confirmation-%s' % notification_type
notification_message = portal.portal_notifications.getDocumentValue(reference=notification_reference,
language=language)
if notification_message is None:
raise ValueError, 'Unable to found Notification Message with reference "%s".' % notification_reference
if reference is None:
login_list = recipient.searchFolder(portal_type="ERP5 Login")
if login_list:
reference = login_list[0].getReference()
#Set notification mapping
notification_mapping_dict = {
'login_name': reference,
'name': recipient.getTitle()}
if password:
notification_mapping_dict.update(
{'login_password' : password})
#Preserve HTML else convert to text
if notification_message.getContentType() == "text/html":
mail_text = notification_message.asEntireHTML(
substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict})
else:
mail_text = notification_message.asText(
substitution_method_parameter_dict={'mapping_dict':notification_mapping_dict})
# Send email
portal.portal_notifications.sendMessage(
sender=sender,
recipient=recipient,
subject=notification_message.getTitle(),
message=mail_text,
message_text_format=notification_message.getContentType(),
notifier_list=(portal.portal_preferences.getPreferredLoginAndPasswordNotifier(),),
store_as_event= portal.portal_preferences.isPreferredStoreEvents(),
event_keyword_argument_dict={'follow_up':context.getRelativeUrl()},
)
<?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>reference, password</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_sendAcceptedNotification</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
from zExceptions import Unauthorized
if REQUEST is not None:
raise Unauthorized
# It is mandatory use pass a contract to skip reservation
# as annonymous can request via website knowning the user's
# email
if contract is None:
return
if context.SubscriptionRequest_getTransactionalUser() is not None:
if contract.getMaximumInvoiceDelay() > 0:
return True
else:
person = context.getDestinationSectionValue()
if person.Entity_statSlapOSOutstandingAmount() > 0:
return
if contract.getMaximumInvoiceDelay() > 0:
return True
<?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>contract=None, REQUEST=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_testSkippedReservationFree</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testSlapOSSubscriptionSkins</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testSlapOSSubscriptionSkins</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Instance Tree | jump_to_related_subscription_request
Person | jump_to_subscription_request
Sale Invoice Transaction | jump_to_related_subscription_request
Subscription Request Module | notify_active_subscriber_list
Subscription Request Module | rss_view
Subscription Request Module | view
Subscription Request | view
\ No newline at end of file
test.erp5.testSlapOSSubscriptionAlarm
test.erp5.testSlapOSSubscriptionSkins
\ No newline at end of file
test.erp5.testSlapOSSubscriptionAlarm
\ No newline at end of file
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