mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-18 07:52:23 +01:00
(feat) show invoice payment method in accounting line
This commit is contained in:
parent
74d9cc462d
commit
71275f18a1
@ -2,6 +2,7 @@
|
||||
|
||||
- Fix a bug: unable to show wallet payment mean for invoice
|
||||
- improvement: remove show_username_in_admin_list setting
|
||||
- improvement: show invoice payment method in accounting line
|
||||
- [TODO DEPLOY] `rails fablab:setup:build_accounting_lines`
|
||||
|
||||
## v6.3.6 2023 December 6
|
||||
|
@ -5,4 +5,16 @@
|
||||
class AccountingLine < ApplicationRecord
|
||||
belongs_to :invoice
|
||||
belongs_to :invoicing_profile
|
||||
|
||||
def invoice_payment_method
|
||||
# if the invoice was 100% payed with the wallet ...
|
||||
return 'wallet' if (!invoice.wallet_amount.nil? && (invoice.wallet_amount - invoice.total == 0)) || invoice.payment_method == 'wallet'
|
||||
|
||||
# else
|
||||
if invoice.paid_by_card?
|
||||
'card'
|
||||
else
|
||||
'other'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,6 +9,7 @@ json.lines @lines do |line|
|
||||
json.extract! line.invoice, :reference, :id
|
||||
json.label Invoices::LabelService.build(line.invoice)
|
||||
json.url download_open_api_v1_invoice_path(line.invoice)
|
||||
json.payment_method line.invoice_payment_method
|
||||
if @codes.values.include?(line.account_code) # if this is a 'payment' line
|
||||
mean = @codes.select { |_key, value| value == line.account_code }
|
||||
json.payment_details line.invoice.payment_details(mean.keys[0])
|
||||
|
Loading…
x
Reference in New Issue
Block a user