So creating a new Transaction looks something like the below:-
txn = data.Transaction(
meta, date, self.FLAG, None, description,
data.EMPTY_SET, data.EMPTY_SET, [
data.Posting(account_name, amount_val, None, None, None, None),
data.Posting(account_name_2, -amount_val, None, None, None, None)
]
)
If I don't specify metadata at all (use an empty dictionary) then it will throw a KeyError from line 586 in core/data.py in entry_sortkey
But if I just specify a nonsense value (identical across all transactions) it works, and doesn't affect anything else.
Does it make more sense not to require metadata at all when creating Transactions?