No need to ensure if the distribution is set on new action

This will be handled by validation on set_distribution action
This commit is contained in:
Jean-Baptiste Bellet
2023-04-17 17:19:09 +02:00
parent 73a81310f8
commit 05a040b4c3

View File

@@ -12,8 +12,6 @@ module Spree
:invoice, :print, :set_distribution]
before_action :load_distribution_choices, only: [:new, :edit, :update, :set_distribution]
# Ensure that the distributor is set for an order when
before_action :ensure_distribution, only: :new
before_action :require_distributor_abn, only: :invoice
respond_to :html, :json
@@ -145,17 +143,6 @@ module Spree
ocs.closed +
ocs.undated
end
def ensure_distribution
unless @order
@order = Spree::Order.new
@order.generate_order_number
@order.save!
end
return if @order.distribution_set?
render 'set_distribution', locals: { order: @order }
end
end
end
end