Add a button to trigger GnuCash CSV generation to the invoice_form view
This button is only there if information has been filled in for the company and customer.
This commit is contained in:
parent
cd488cbee8
commit
e21058c5d8
1 changed files with 10 additions and 0 deletions
10
stoptime.rb
10
stoptime.rb
|
@ -1388,6 +1388,8 @@ module StopTime::Controllers
|
|||
tex_file = PUBLIC_DIR + "invoices/#{@number}.tex"
|
||||
pdf_file = PUBLIC_DIR + "invoices/#{@number}.pdf"
|
||||
csv_file = PUBLIC_DIR + "invoices/#{@number}.csv"
|
||||
@csv_enabled = @company.gnucash_revenues_account_name.present? &&
|
||||
@customer.gnucash_customer_owner_id.present?
|
||||
if @format == "html"
|
||||
@input = @invoice.attributes
|
||||
@invoice_file_present = tex_file.exist? || csv_file.exist?
|
||||
|
@ -2652,6 +2654,14 @@ module StopTime::Views
|
|||
_icon("download")
|
||||
span "Download LaTeX"
|
||||
end
|
||||
if @csv_enabled
|
||||
a.btn.btn_default role: "button",
|
||||
href: R(CustomersNInvoicesX,
|
||||
@customer.id, "#{@invoice.number}.csv") do
|
||||
_icon("download")
|
||||
span "Download GnuCash CSV"
|
||||
end
|
||||
end
|
||||
a.btn.btn_default role: "button",
|
||||
href: R(Company, revision: @company.revision) do
|
||||
_icon("briefcase")
|
||||
|
|
Loading…
Reference in a new issue