Commit 019f4001 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Ensure the Source Section is consistent with the invoices

parent 456ae120
Pipeline #14744 failed with stage
in 0 seconds
...@@ -30,6 +30,7 @@ if sale_packing_list_list: ...@@ -30,6 +30,7 @@ if sale_packing_list_list:
strict_causality_uid=[x.getUid() for x in sale_packing_list_list], strict_causality_uid=[x.getUid() for x in sale_packing_list_list],
) )
subscription_currency = subscription_request.getPriceCurrency() subscription_currency = subscription_request.getPriceCurrency()
subscription_source_section = subscription_request.getSourceSection()
for sale_invoice in sale_invoice_list: for sale_invoice in sale_invoice_list:
sale_invoice = sale_invoice.getObject() sale_invoice = sale_invoice.getObject()
if sale_invoice.getPriceCurrency() != subscription_currency: if sale_invoice.getPriceCurrency() != subscription_currency:
...@@ -42,11 +43,21 @@ if sale_packing_list_list: ...@@ -42,11 +43,21 @@ if sale_packing_list_list:
} }
) )
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"): if sale_invoice.getSimulationState() not in ("stopped", "delivered", "cancelled"):
addToStatusList( addToStatusList(
"${invoice_relative_url} Sale Invoice in unexpected simulation state: ${invoice_simulation_state}", "${invoice_relative_url} Sale Invoice in unexpected simulation state: ${invoice_simulation_state}",
{ {
"invoice_relative_url": sale_invoice.getRelativeUrl(), "invoice_relative_url": sale_invoice.absolute_url(),
"invoice_simulation_state": sale_invoice.getSimulationState(), "invoice_simulation_state": sale_invoice.getSimulationState(),
} }
) )
......
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