mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-30 19:52:20 +01:00
(bug) no main item on some invoices
This commit is contained in:
parent
5dae938078
commit
8863ac7047
@ -1,5 +1,6 @@
|
||||
# Changelog Fab-manager
|
||||
|
||||
- Fix a bug: no main item on some invoices
|
||||
- Fix a bug: unable to build accounting lines if no invoices
|
||||
- Fix a bug: unable to apply rounding correction on accounting lines
|
||||
- Fix a bug: empty object for some invoice item
|
||||
|
@ -132,7 +132,12 @@ class Invoice < PaymentDocument
|
||||
end
|
||||
|
||||
def main_item
|
||||
invoice_items.where(main: true).first
|
||||
main = invoice_items.where(main: true).first
|
||||
if main.nil?
|
||||
main = invoice_items.order(id: :asc).first
|
||||
main&.update(main: true)
|
||||
end
|
||||
main
|
||||
end
|
||||
|
||||
def other_items
|
||||
|
Loading…
x
Reference in New Issue
Block a user