Base invoice posted status on the presence of a posted transaction rather than a posted account

Bills and invoices that are posted and subsequently unposted again still store their
posted account internally as a convenience to the user (upon reposting the old
account will be offered by default) so it's not a reliable test for the posted state.
The posted transaction on the other hand is guaranteed to only exist when the invoice is
posted. This should fix a slew of small and perhaps larger side effects, such as
a posted bill still appearing as editable, critical warnings when creating new bills/invoices
and so on.
This commit is contained in:
Geert Janssens 2018-04-14 18:46:26 +02:00
parent 6093e5978f
commit dcfc1280bd

View File

@ -1859,7 +1859,7 @@ gncInvoiceApplyPayment (const GncInvoice *invoice, Transaction *txn,
gboolean gncInvoiceIsPosted (const GncInvoice *invoice)
{
if (!invoice) return FALSE;
return GNC_IS_ACCOUNT(gncInvoiceGetPostedAcc(invoice));
return GNC_IS_TRANSACTION(gncInvoiceGetPostedTxn(invoice));
}
gboolean gncInvoiceIsPaid (const GncInvoice *invoice)