Commit 765c89f8 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Index with specific tag and set tag on the request

This indicates on the transaction and on indexation that a payment was created for the invoice. This allow us to avoid duplicated creation due race conditions on activities.
parent fa27ca24
......@@ -3,3 +3,11 @@ payment_transaction = context
comment = translateString("Initialised by Order Builder.")
payment_transaction.confirm(comment=comment)
# Reindex with a tag to ensure that there will be no generation while the object isn't
# reindexed.
payment_tag ="sale_invoice_transaction_order_builder_%s" % context.getCausalityUid()
payment_transaction.activate(tag=payment_tag).immediateReindexObject()
# Set a flag on the request for prevent 2 calls on the same transaction
context.REQUEST.set(payment_tag, 1)
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