update the set_distribution form on the same path

and use the same method `OrdersController#set_distribution`
This commit is contained in:
Jean-Baptiste Bellet
2023-04-18 11:22:41 +02:00
parent da25dd775c
commit 88fa689cbc
2 changed files with 10 additions and 2 deletions

View File

@@ -24,7 +24,15 @@ module Spree
redirect_to spree.distribution_admin_order_path(@order)
end
def set_distribution; end
def set_distribution
return if order_params.blank?
on_update
@order.update(order_params)
@order.save
redirect_to spree.admin_order_customer_path(@order)
end
def edit
@order.shipments.map(&:refresh_rates)

View File

@@ -17,7 +17,7 @@
= render 'spree/shared/error_messages', :target => @order
%div{"ng-app" => "admin.orders", "ng-controller" => "orderCtrl"}
= form_for @order, url: admin_order_url(@order), method: :put do |f|
= form_for @order, url: distribution_admin_order_path(@order), method: :put do |f|
= render 'spree/admin/orders/_form/distribution_fields'
-# This param passed to stop validation error in next page due to no line items in order yet:
= hidden_field_tag 'suppress_error_msg', "true"