Add role_invoices

This new role allows users to create invoices without role_finance. Users
can then only modify their own created invoices until somebody with the
role_finance sets the paid_on value.
This commit is contained in:
Patrick Gansterer 2016-02-17 21:07:35 +01:00 committed by wvengen
parent 273969ac90
commit 1315103a7d
20 changed files with 73 additions and 20 deletions

View file

@ -15,7 +15,8 @@
= f.association :supplier, hint: false
= f.input :number
= f.input :date, as: :date_picker
= f.input :paid_on, as: :date_picker
- if current_user.role_finance?
= f.input :paid_on, as: :date_picker
= f.input :amount, as: :string
= f.input :deposit, as: :string
= f.input :deposit_credit, as: :string

View file

@ -32,6 +32,10 @@
= ', ' if index > 0
= link_to format_date(order.ends), new_finance_order_path(order_id: order)
%td= truncate(invoice.note)
%td= link_to t('ui.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini'
%td= link_to t('ui.delete'), finance_invoice_path(invoice), :data => {:confirm => t('.confirm_delete')}, :method => :delete,
class: 'btn btn-danger btn-mini'
%td
- if invoice.user_can_edit?(current_user)
= link_to t('ui.edit'), edit_finance_invoice_path(invoice), class: 'btn btn-mini'
%td
- if invoice.user_can_edit?(current_user)
= link_to t('ui.delete'), finance_invoice_path(invoice), :data => {:confirm => t('.confirm_delete')}, :method => :delete,
class: 'btn btn-danger btn-mini'

View file

@ -47,5 +47,6 @@
%b= heading_helper(Invoice, :note) + ':'
=h @invoice.note
= link_to t('ui.edit'), edit_finance_invoice_path(@invoice)
- if @invoice.user_can_edit?(current_user)
= link_to t('ui.edit'), edit_finance_invoice_path(@invoice)
= link_to t('ui.or_cancel'), finance_invoices_path