make settle directly less dangerous
(closes foodcoops#275)
This commit is contained in:
parent
ea8e4ee560
commit
852f3484ad
5 changed files with 18 additions and 12 deletions
|
|
@ -224,6 +224,7 @@ class Order < ActiveRecord::Base
|
|||
# Close the order directly, without automaticly updating ordergroups account balances
|
||||
def close_direct!(user)
|
||||
raise I18n.t('orders.model.error_closed') if closed?
|
||||
comments.create(user: user, text: I18n.t('orders.model.close_direct_message'))
|
||||
update_attributes! state: 'closed', updated_by: user
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -21,11 +21,9 @@
|
|||
- unless order.closed?
|
||||
- if current_user.role_orders?
|
||||
- unless order.stockit?
|
||||
= link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-mini'
|
||||
= link_to t('orders.index.action_receive'), receive_order_path(order), class: 'btn btn-small'
|
||||
- else
|
||||
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-mini disabled'
|
||||
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-mini btn-primary'
|
||||
= link_to t('.close'), close_direct_finance_order_path(order),
|
||||
:data => {:confirm => t('.confirm')}, :method => :patch, class: 'btn btn-mini'
|
||||
= link_to t('orders.index.action_receive'), '#', class: 'btn btn-small disabled'
|
||||
= link_to t('.clear'), new_finance_order_path(order_id: order.id), class: 'btn btn-small btn-primary'
|
||||
- else
|
||||
%i= t('.no_closed_orders')
|
||||
|
|
|
|||
|
|
@ -48,12 +48,18 @@
|
|||
#comments= render :partial => 'shared/comments', locals: {comments: @order.comments.includes(:user)}
|
||||
|
||||
- content_for :actionbar do
|
||||
- unless @order.invoice or @order.stockit?
|
||||
= link_to t('.create_invoice'), new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier),
|
||||
class: 'btn'
|
||||
.btn-group
|
||||
- unless @order.invoice or @order.stockit?
|
||||
= link_to t('.create_invoice'), new_finance_invoice_path(:order_id => @order, :supplier_id => @order.supplier),
|
||||
class: 'btn'
|
||||
- unless @order.closed?
|
||||
= link_to t('.confirm_order'), confirm_finance_order_path(@order), class: 'btn btn-primary'
|
||||
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
|
||||
%span.caret
|
||||
%ul.dropdown-menu
|
||||
%li= link_to t('.confirm_order'), confirm_finance_order_path(@order)
|
||||
%li= link_to t('.close_direct'), close_direct_finance_order_path(@order), method: :patch,
|
||||
data: {confirm: t('.close_direct_confirm')}
|
||||
|
||||
#editOrderNav.btn-group.pull-right
|
||||
= link_to '#', data: {toggle: 'dropdown'}, class: 'btn dropdown-toggle' do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue