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

@ -6,6 +6,7 @@
= f.input :role_article_meta
= f.input :role_orders
= f.input :role_finance
= f.input :role_invoices
= f.input :role_admin
= render 'shared/group_form_fields', :f => f, captured: captured
.form-actions

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

View file

@ -41,6 +41,10 @@
= f.label :role_finance
%br/
= f.check_box :role_finance
%p
= f.label :role_invoices
%br/
= f.check_box :role_invoices
%p
= f.label :role_orders
%br/

View file

@ -11,6 +11,7 @@
%th Role Suppliers
%th Role Article Meta
%th Role Finance
%th Role Invoices
%th Role Orders
%th Deleted At
%th Contact Person
@ -28,6 +29,7 @@
%td= h ordergroup.role_suppliers
%td= h ordergroup.role_article_meta
%td= h ordergroup.role_finance
%td= h ordergroup.role_invoices
%td= h ordergroup.role_orders
%td= h ordergroup.deleted_at
%td= h ordergroup.contact_person

View file

@ -41,6 +41,10 @@
= f.label :role_finance
%br/
= f.check_box :role_finance
%p
= f.label :role_invoices
%br/
= f.check_box :role_invoices
%p
= f.label :role_orders
%br/

View file

@ -11,6 +11,7 @@
%th Role Suppliers
%th Role Article Meta
%th Role Finance
%th Role Invoices
%th Role Orders
%th Deleted At
%th Contact Person
@ -28,6 +29,7 @@
%td= h workgroup.role_suppliers
%td= h workgroup.role_article_meta
%td= h workgroup.role_finance
%td= h workgroup.role_invoices
%td= h workgroup.role_orders
%td= h workgroup.deleted_at
%td= h workgroup.contact_person