Add stock group order
This allows us to add additional items to an order, which do not belong a specific user, but will be put into stock. The benefit of this change is that we use the same order for ordergroups and stock.
This commit is contained in:
parent
b56df39623
commit
9c4d9d5c20
8 changed files with 42 additions and 11 deletions
|
|
@ -12,7 +12,8 @@ class GroupOrdersController < ApplicationController
|
|||
end
|
||||
|
||||
def new
|
||||
@group_order = @order.group_orders.build(:ordergroup => @ordergroup, :updated_by => current_user)
|
||||
ordergroup = params[:stock_order] ? nil : @ordergroup
|
||||
@group_order = @order.group_orders.build(:ordergroup => ordergroup, :updated_by => current_user)
|
||||
@ordering_data = @group_order.load_data
|
||||
end
|
||||
|
||||
|
|
@ -80,13 +81,14 @@ class GroupOrdersController < ApplicationController
|
|||
redirect_to :action => 'index'
|
||||
end
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
redirect_to group_orders_url, alert: I18n.t('group_orders.errors.notfound')
|
||||
redirect_to group_orders_url, alert: I18n.t('group_orders.errors.notfound')
|
||||
end
|
||||
|
||||
def ensure_my_group_order
|
||||
@group_order = @ordergroup.group_orders.find(params[:id])
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
redirect_to group_orders_url, alert: I18n.t('group_orders.errors.notfound')
|
||||
@group_order = GroupOrder.find_by_id(params[:id])
|
||||
if @group_order.ordergroup != @ordergroup && (@group_order.ordergroup || !current_user.role_orders?)
|
||||
redirect_to group_orders_url, alert: I18n.t('group_orders.errors.notfound')
|
||||
end
|
||||
end
|
||||
|
||||
def enough_apples?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue