1
0
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:
Sylvain 2023-01-06 10:31:20 +01:00
parent 5dae938078
commit 8863ac7047
2 changed files with 7 additions and 1 deletions

View File

@ -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

View File

@ -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