update state machine

This commit is contained in:
olegphenomenon 2023-02-27 09:48:45 +02:00
parent d28afca00f
commit 06d34e30a8

View file

@ -38,7 +38,7 @@ class InvoiceStateMachine
end end
def mark_as_unpaid def mark_as_unpaid
return push_error if invoice.paid? && invoice.payment_orders.last.payment_reference? || invoice.cancelled? return push_error if invoice.paid? && invoice.payment_orders&.last&.payment_reference? || invoice.cancelled?
return true unless invoice.paid? return true unless invoice.paid?
invoice.cancel_manualy invoice.cancel_manualy