Fix list of invoices when an invoice has an invalid created_by user

This commit is contained in:
Patrick Gansterer 2017-09-26 13:13:20 +02:00
parent 43294a40f5
commit ac00942f34

View file

@ -30,7 +30,7 @@ class Invoice < ActiveRecord::Base
end
def user_can_edit?(user)
user.role_finance? || (user.role_invoices? && !self.paid_on && self.created_by.id == user.id)
user.role_finance? || (user.role_invoices? && !self.paid_on && self.created_by.try(:id) == user.id)
end
# Amount without deposit