r21998 - gnucash/trunk/src/engine - Improve open lot selection when posting an invoice
Geert Janssens
gjanssens at code.gnucash.org
Fri Feb 10 10:34:37 EST 2012
Author: gjanssens
Date: 2012-02-10 10:34:36 -0500 (Fri, 10 Feb 2012)
New Revision: 21998
Trac: http://svn.gnucash.org/trac/changeset/21998
Modified:
gnucash/trunk/src/engine/gncInvoice.c
Log:
Improve open lot selection when posting an invoice
Modified: gnucash/trunk/src/engine/gncInvoice.c
===================================================================
--- gnucash/trunk/src/engine/gncInvoice.c 2012-02-10 15:34:28 UTC (rev 21997)
+++ gnucash/trunk/src/engine/gncInvoice.c 2012-02-10 15:34:36 UTC (rev 21998)
@@ -1644,10 +1644,16 @@
if (lm->positive_balance == gnc_numeric_positive_p (balance))
return FALSE;
- /* Is it ours? */
+ /* Is it ours? Either the lot owner or the lot invoice owner should match */
if (!gncOwnerGetOwnerFromLot (lot, &owner_def))
- return FALSE;
- owner = gncOwnerGetEndOwner (&owner_def);
+ {
+ const GncInvoice *invoice = gncInvoiceGetInvoiceFromLot (lot);
+ if (!invoice)
+ return FALSE;
+ owner = gncOwnerGetEndOwner (gncInvoiceGetOwner (invoice));
+ }
+ else
+ owner = gncOwnerGetEndOwner (&owner_def);
return gncOwnerEqual (owner, lm->owner);
}
More information about the gnucash-changes
mailing list