mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Add begin-edit/commit-edit calls around lot manipulation when posting
an invoice. This keeps the sql backend from trying to save a lot with a null account. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@17475 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
290b0c6f12
commit
7c36cf65f6
@ -906,6 +906,7 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
||||
/* Create a new lot for this invoice, if we need to do so */
|
||||
if (!lot)
|
||||
lot = gnc_lot_new (book);
|
||||
gnc_lot_begin_edit (lot);
|
||||
|
||||
type = gncInvoiceGetType (invoice);
|
||||
|
||||
@ -1126,6 +1127,7 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
||||
|
||||
t2 = xaccMallocTransaction (book);
|
||||
lot2 = gnc_lot_new (book);
|
||||
gnc_lot_begin_edit (lot2);
|
||||
gncOwnerAttachToLot (gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice)),
|
||||
lot2);
|
||||
|
||||
@ -1162,10 +1164,12 @@ Transaction * gncInvoicePostToAccount (GncInvoice *invoice, Account *acc,
|
||||
xaccSplitSetBaseValue (split, total, invoice->currency);
|
||||
gnc_lot_add_split (lot2, split);
|
||||
|
||||
gnc_lot_commit_edit (lot2);
|
||||
xaccTransCommitEdit (t2);
|
||||
xaccAccountCommitEdit (acc);
|
||||
}
|
||||
|
||||
gnc_lot_commit_edit (lot);
|
||||
gncInvoiceCommitEdit (invoice);
|
||||
|
||||
return txn;
|
||||
|
Loading…
Reference in New Issue
Block a user