diff --git a/app/models/order.rb b/app/models/order.rb index ea4dcaea..6546e005 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -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 diff --git a/app/views/finance/balancing/_orders.html.haml b/app/views/finance/balancing/_orders.html.haml index 4675c79c..3f20d850 100644 --- a/app/views/finance/balancing/_orders.html.haml +++ b/app/views/finance/balancing/_orders.html.haml @@ -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') diff --git a/app/views/finance/balancing/new.html.haml b/app/views/finance/balancing/new.html.haml index 5395e7a4..a41687e0 100644 --- a/app/views/finance/balancing/new.html.haml +++ b/app/views/finance/balancing/new.html.haml @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index e6114c87..88a099f9 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -542,6 +542,8 @@ en: comment_on_transaction: Here you can add a comment to your accounting. comments: Comments confirm_order: Settle order + close_direct: Skip settling + close_direct_confirm: 'You are about to settle the order without charging member acounts. Do this only when you have already debited member accounts manually, or if you really know what you are doing.' create_invoice: Create invoice edit_note: Edit note edit_order: Edit order @@ -556,8 +558,6 @@ en: orders: clear: accounting cleared: accounted (%{amount}) - close: settle directly - confirm: Do you really want to settle the order? end: End ended: closed name: Supplier @@ -1110,6 +1110,7 @@ en: orders_settled: Settled title: Manage orders model: + close_direct_message: Order settled without charging member accounts. error_closed: Order was already settled error_nosel: At least one article must be selected error_starts_before_ends: must be after the start date (or remain empty) diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 3d529750..631bc01b 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -540,6 +540,8 @@ nl: comment_on_transaction: Hier kun je een notitie aan de afrekening toevoegen. comments: Notities confirm_order: Afrekenen + close_direct: Afrekenen overslaan + close_direct_confirm: 'Je staat op het punt de bestelling af te sluiten zonder de bedragen in rekening te brengen bij de huishoudens. Doe dit alleen wanneer je deze bedragen al handmatig hebt afgeschreven, of als je echt weet wat je doet!' create_invoice: Rekening toevoegen edit_note: Notitie bewerken edit_order: Bestelling bewerken @@ -554,8 +556,6 @@ nl: orders: clear: balans cleared: afgerekend (%{amount}) - close: direct afrekenen - confirm: Weet je zeker dat de je bestelling wilt afrekenen? end: Einde ended: gesloten name: Leverancier