Commit 7b578fd1 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: drop audit from Subscription Request

parent 5177d1aa
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
<item>Price</item> <item>Price</item>
<item>Reference</item> <item>Reference</item>
<item>SlapOSVirtualMasterSourceProjectConstraint</item> <item>SlapOSVirtualMasterSourceProjectConstraint</item>
<item>SlaposSubscriptionRequestAuditConstraint</item>
<item>Task</item> <item>Task</item>
<item>Url</item> <item>Url</item>
<item>VariationRange</item> <item>VariationRange</item>
......
...@@ -9,6 +9,6 @@ ...@@ -9,6 +9,6 @@
</chain> </chain>
<chain> <chain>
<type>Subscription Request</type> <type>Subscription Request</type>
<workflow>audit_validation_workflow, edit_workflow, subscription_request_workflow</workflow> <workflow>edit_workflow, subscription_request_workflow</workflow>
</chain> </chain>
</workflow_chain> </workflow_chain>
\ No newline at end of file
subscription_request = context
portal = context.getPortalObject()
translate = portal.Base_translateString
status_list = []
def addToStatusList(status_text, mapping):
status_list.append(translate(
status_text,
mapping=mapping
))
if not context.getSimulationState() in ("ordered", "confirmed", "started", "stopped", "delivered"):
return []
subscription_trade_condition = portal.sale_trade_condition_module.slapos_aggregated_subscription_trade_condition
#refund_service = portal.service_module.slapos_reservation_refund
sale_packing_list_list = portal.portal_catalog(
portal_type="Sale Packing List",
strict_causality_uid=subscription_request.getUid(),
strict_destination_uid=subscription_request.getDestinationSectionUid(),
strict_destination_section_uid=subscription_request.getDestinationSectionUid(),
strict_specialise_uid=subscription_trade_condition.getUid(),
simulation_state="delivered",
)
if sale_packing_list_list:
sale_invoice_list = portal.portal_catalog(
portal_type="Sale Invoice Transaction",
strict_causality_uid=[x.getUid() for x in sale_packing_list_list],
)
trade_condition = subscription_request.getSpecialiseValue().getSpecialiseValue()
subscription_currency = trade_condition.getPriceCurrency()
subscription_source_section = trade_condition.getSourceSection()
for sale_invoice in sale_invoice_list:
sale_invoice = sale_invoice.getObject()
if sale_invoice.getPriceCurrency() != subscription_currency:
addToStatusList(
"${invoice_relative_url} Sale Invoice currency ${invoice_currency} do not match subscription currency ${subscription_currency}",
{
"invoice_relative_url": sale_invoice.getRelativeUrl(),
"invoice_currency": sale_invoice.getPriceCurrency(),
"subscription_currency": subscription_currency,
}
)
if sale_invoice.getSourceSection() != subscription_source_section:
addToStatusList(
"${invoice_relative_url} Sale Invoice Source ${invoice_source_section} do not match subscription source section ${subscription_source_section}",
{
"invoice_relative_url": sale_invoice.getRelativeUrl(),
"invoice_source_section": sale_invoice.getSourceSection(),
"subscription_source_section": subscription_source_section,
}
)
if sale_invoice.getSimulationState() not in ("stopped", "delivered", "cancelled"):
addToStatusList(
"${invoice_relative_url} Sale Invoice in unexpected simulation state: ${invoice_simulation_state}",
{
"invoice_relative_url": sale_invoice.absolute_url(),
"invoice_simulation_state": sale_invoice.getSimulationState(),
}
)
return status_list
<?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>fixit=0</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequest_checkRelatedAccounting</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -13,7 +13,6 @@ Subscription Request | Person ...@@ -13,7 +13,6 @@ Subscription Request | Person
Subscription Request | Price Subscription Request | Price
Subscription Request | Reference Subscription Request | Reference
Subscription Request | SlapOSVirtualMasterSourceProjectConstraint Subscription Request | SlapOSVirtualMasterSourceProjectConstraint
Subscription Request | SlaposSubscriptionRequestAuditConstraint
Subscription Request | Task Subscription Request | Task
Subscription Request | Url Subscription Request | Url
Subscription Request | VariationRange Subscription Request | VariationRange
\ No newline at end of file
Email | -coordinate_interaction_workflow Email | -coordinate_interaction_workflow
Subscription Condition | commerce_validation_workflow Subscription Condition | commerce_validation_workflow
Subscription Condition | edit_workflow Subscription Condition | edit_workflow
Subscription Request | audit_validation_workflow
Subscription Request | edit_workflow Subscription Request | edit_workflow
Subscription Request | subscription_request_workflow Subscription Request | subscription_request_workflow
\ 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