Allow creating backorders before order cycle opens

Admins may want to pre-process some orders manually for going public.
And it's good to reserve stock for these.

At some point in the future, the supplier may have an order cycle with
its own times but the current FDC implementation allows orders at any
time.
This commit is contained in:
Maikel Linke
2025-01-09 13:32:43 +11:00
parent 884206b4ed
commit dc7b6245fd

View File

@@ -27,9 +27,9 @@ class AmendBackorderJob < ApplicationJob
user = order.distributor.owner
urls = nil # Not needed to send order. The backorder id is the URL.
FdcBackorderer.new(user, urls).send_order(backorder)
elsif order.order_cycle.open?
elsif !order.order_cycle.closed?
# We don't have an order to amend but the order cycle is open.
# We don't have an order to amend but the order cycle is or will open.
# We can assume that this job was triggered by an admin creating a new
# order or adding backorderable items to an order.
BackorderJob.new.place_backorder(order)