engine objects vs. SX or invoices (was: GDA: A few questions)

Chris Shoemaker c.shoemaker at cox.net
Tue Dec 12 10:21:24 EST 2006


On Tue, Dec 12, 2006 at 10:05:21AM -0500, Josh Sled wrote:
> On Mon, 2006-12-11 at 22:06 -0500, Chris Shoemaker wrote:
> > Invoices basically reuse the engine objects.  But SXs have:
> > struct TTInfo_s
> [...]
> > which look suspiciously like a Transaction, and 
> > 
> > struct TTSplitInfo_s
> [...]
> > which looks suspiciously like a Split.  And then the whole duplicated
> > accounts setup.  
> 
> These structures aren't the actual storage, and are only barely used as
> runtime representations of Template [Splits and] Transactions.
> 
> They were sourced from Robert Merkel's work on the "SX-from-transaction"
> dialog, and are used (by my hand) in the Mortgage/Loan Druid.  In both
> cases, they're immediately passed to
> xaccSchedXactionSetTemplateTrans(...), which just converts these
> degenerate structures into the "real" template Transactions.  Looking
> back on it, I'd just the calling code to write the template structures
> directly, though maybe with some convenience functions for readability.

Ah, thanks for explaining that.  That does make a lot more sense.

> The only structures relevant are the Accounts, Transactions and Splits
> rooted in the "Template" Account-Group.

So, they already are "real" Transactions/Splits in an alternate
Account hierarchy, where every account must refer to a "real" account,
(named by its guid).

So then, my recommendation is just to use real accounts and flag the
transactions as "templates."  Although, this was originally brought up
in the context of the register-rewrite, and using the "alternate"
accounts is not a big deal in the register-rewrite.  So, this has just
been me harping on what I think is a good code improvement.

-chris


More information about the gnucash-devel mailing list