Class: Backend::InventoriesController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/inventories_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Instance Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Instance Method Details

#indexObject

Displays the main page with the list of inventories


41
42
43
44
45
# File 'app/controllers/backend/inventories_controller.rb', line 41

def index
  unless ProductNature.stockables.any?
    notify_now(:need_stocks_to_create_inventories)
  end
end

#reflectObject


68
69
70
71
72
73
74
75
76
# File 'app/controllers/backend/inventories_controller.rb', line 68

def reflect
  return unless @inventory = find_and_check
  if @inventory.reflect
    notify_success(:changes_have_been_reflected)
  else
    notify_error(:changes_have_not_been_reflected)
  end
  redirect_to action: :index
end

#refreshObject


62
63
64
65
66
# File 'app/controllers/backend/inventories_controller.rb', line 62

def refresh
  return unless @inventory = find_and_check
  @inventory.refresh!
  redirect_to action: :edit, id: @inventory.id
end

#showObject


47
48
49
50
51
# File 'app/controllers/backend/inventories_controller.rb', line 47

def show
  return unless @inventory = find_and_check
  t3e @inventory
  respond_with(@inventory, include: [:responsible, { items: { methods: :unit_name, include: [:product, :container] } }])
end