From a64aea4b9cb6b433652c034aa0f16f4ea4d5c4ae Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Tue, 15 Oct 2024 13:36:57 +1100 Subject: [PATCH] Remove StockLocation from ReturnAuthorization We have only one default location and don't need it associated to anything. --- .../spree/admin/return_authorizations_controller.rb | 2 +- app/models/spree/return_authorization.rb | 2 +- app/views/spree/admin/return_authorizations/_form.html.haml | 5 ----- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/app/controllers/spree/admin/return_authorizations_controller.rb b/app/controllers/spree/admin/return_authorizations_controller.rb index 84b85ad3452..9e1d2415595 100644 --- a/app/controllers/spree/admin/return_authorizations_controller.rb +++ b/app/controllers/spree/admin/return_authorizations_controller.rb @@ -23,7 +23,7 @@ def associate_inventory_units def permitted_resource_params params.require(:return_authorization). - permit(:amount, :reason, :stock_location_id) + permit(:amount, :reason) end end end diff --git a/app/models/spree/return_authorization.rb b/app/models/spree/return_authorization.rb index 9d7a7dea2d3..94108997631 100644 --- a/app/models/spree/return_authorization.rb +++ b/app/models/spree/return_authorization.rb @@ -2,12 +2,12 @@ module Spree class ReturnAuthorization < ApplicationRecord + self.ignored_columns += [:stock_location_id] acts_as_paranoid belongs_to :order, class_name: 'Spree::Order', inverse_of: :return_authorizations has_many :inventory_units, inverse_of: :return_authorization, dependent: :nullify - has_one :stock_location, dependent: nil before_save :force_positive_amount before_create :generate_number diff --git a/app/views/spree/admin/return_authorizations/_form.html.haml b/app/views/spree/admin/return_authorizations/_form.html.haml index abea5433598..396200b962b 100644 --- a/app/views/spree/admin/return_authorizations/_form.html.haml +++ b/app/views/spree/admin/return_authorizations/_form.html.haml @@ -41,8 +41,3 @@ = f.label :reason, t('.reason') = f.text_area :reason, { style: 'height:100px;', class: 'fullwidth' } = f.error_message_on :reason - - = f.field_container :stock_location do - = f.label :stock_location, t('.stock_location') - = f.select :stock_location_id, Spree::StockLocation.all.collect{ |l| [l.name, l.id] }, { style: 'height:100px;', class: 'fullwidth' } - = f.error_message_on :reason