Commit 5dddea56 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: update subscription history ifvalidation is rejected

parent 113987ec
subscription_request = context
def markHistory(document, comment):
portal_workflow = document.portal_workflow
last_workflow_item = portal_workflow.getInfoFor(ob=document,
name='comment', wf_id='edit_workflow')
if last_workflow_item != comment:
portal_workflow.doActionFor(document, action='edit_action', comment=comment)
item = subscription_request.getAggregateValue()
if item is None:
resource = subscription_request.getResourceValue()
......@@ -15,7 +22,8 @@ if (((subscription_request.getSourceProjectValue() is not None) and
(subscription_request.getSourceProjectValue().Item_getSubscriptionStatus() != 'subscribed')) or
((subscription_request.getDestinationProjectValue() is not None) and
(subscription_request.getDestinationProjectValue().Item_getSubscriptionStatus() != 'subscribed'))):
return
return markHistory(subscription_request,
'Virtual master subscription is not valid.')
# Accept the subscription only if user paid the security payment
if (subscription_request.getSourceValue() is None) or \
......@@ -54,7 +62,9 @@ if (subscription_request.getSourceValue() is None) or \
# if not enough, user will have to pay a deposit for the subscription
# XXX probably create an event asking for a deposit
#pass
return 'NO deposit_amount %s\npayable_amount %s\ntotal_price %s' % (deposit_amount, payable_amount, total_price)
return markHistory(subscription_request,
'Not enough deposit from user')
# return 'NO deposit_amount %s\npayable_amount %s\ntotal_price %s' % (deposit_amount, payable_amount, total_price)
#return 'YES deposit_amount %s\npayable_amount %s\ntotal_price %s' % (deposit_amount, payable_amount, total_price)
subscription_request.SubscriptionRequest_createOpenSaleOrder()
......
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