Brett Smith
fa35a70f9f
CODE: Update main loop to reflect the template change in 34b71ba
.
2017-12-19 10:17:15 -05:00
Brett Smith
cc8c03ab62
main: Provide template variables about the file being imported.
2017-12-19 09:13:44 -05:00
Brett Smith
122323853d
importers: Prefer using ChainMaps to copying and updating dicts.
2017-12-19 09:13:44 -05:00
Brett Smith
b41a7a99af
hooks: Filter entries by setting entry_data['_hook_cancel'] to True.
...
The current method only works for plain dicts and other simple mappings.
Mapping that may still contain items after .clear(), like ChainMap, can't
rely on the old method.
2017-12-19 09:13:44 -05:00
Brett Smith
34b71baaf7
template: render() takes a single mapping argument.
...
This lets it receive other mapping types like ChainMap.
2017-12-19 09:13:00 -05:00
Brett Smith
1b98ab2015
util: Rename to strparse.
...
Better describes what the functions in the module do.
2017-12-19 06:42:05 -05:00
Brett Smith
6ea28c2c89
util: Add parse_currency_dec.
...
The current importers trim lots of extraneous symbols and whitespace from
currency strings before passing them to Decimal(). This function takes care
of all that in a single place.
2017-12-18 23:04:05 -05:00
Brett Smith
0734b6f7a5
hooks.invoice_payment: New hook.
...
In the long run, this should be some kind of configurable hook to run
arbitrary regexps on arbitrary entry fields, and then on a match, add
another field with a format string using the match data. But this is
reasonably generic for now.
2017-12-18 17:40:30 -05:00
Brett Smith
9472be10f1
main: Open files with errors='replace'.
...
Stripe payment CSVs have apparently random encoding, and no way what to tell
what they're using beyond chardet.
The better way to fix this is following the existing to-do item, opening
files in binary mode and creating an importer base class to provide text
wrapping. This would let each importer be as strict as possible.
2017-12-18 17:38:55 -05:00
Brett Smith
68a0a9625c
importers.stripe: Generate payment entries for refunded payments.
...
In order to be refunded, the payment had to be paid in the first place, so
we should still generate an entry for it.
2017-12-18 17:32:33 -05:00
Brett Smith
4796932cb7
importers.patreon: Handle commas in large amounts.
2017-12-18 14:09:54 -05:00
Brett Smith
a2120805ab
tests: Remove noop cruft file.
2017-12-18 14:06:53 -05:00
Brett Smith
8696ca33d6
TODO: Start list.
2017-12-18 13:26:32 -05:00
Brett Smith
fea64ee138
main: Don't use importers whose template isn't configured.
...
This lets users import only some information from sources that provide
multiple transaction streams at once.
2017-12-18 12:35:50 -05:00
Brett Smith
0b665d388e
template: Add is_empty method.
...
This makes it easy to detect when a user has specifically cleared a
template; i.e., from a specific configuration section.
2017-12-18 12:35:18 -05:00
Brett Smith
474a0390e3
template: Support custom payee lines.
2017-12-18 12:23:18 -05:00
Brett Smith
668906b944
importers.nbpy2017: Yield entries for the original invoice.
...
This lets us write up a cleaner separation between the original act of
invoicing and the Stripe payment.
2017-12-18 10:47:04 -05:00
Brett Smith
fb0e4f2235
tests: Specify types in importers.yml, rather than munging them manually.
2017-12-18 10:28:05 -05:00
Brett Smith
c98f0d9ff3
importers.nbpy2017: Refactor out _strpdate method.
2017-12-18 10:14:13 -05:00
Brett Smith
8da3fd4bd3
util: Add common word-slicing functions.
2017-12-18 10:14:01 -05:00
Brett Smith
e249049fc1
util: Move module loader functions to a new dynload module.
2017-12-18 09:26:22 -05:00
Brett Smith
f56571219b
importers.nbpy2017: Don't deal with refunds.
...
Only one refund was actually issued, so we can deal with that manually. But
the code did its job of revealing those cases and checking we were handling
them well.
2017-12-18 09:21:31 -05:00
Brett Smith
9d9254b69a
template: Nicer formatting of account split lines.
...
This provides nicer output when the whole line can fit in the desired width,
even if the account name or amount are unusually long.
2017-12-17 21:05:22 -05:00
Brett Smith
93fffe6666
importers: New importer for North Bay Python invoices.
...
This probably has no use outside Conservancy.
2017-12-17 20:46:00 -05:00
Brett Smith
a924d9fb1f
tests: Support more Decimal values from importers without specifying them all.
2017-12-17 13:42:51 -05:00
Brett Smith
e3ec03cf19
template: Don't output accounts that end up having no amount.
2017-12-16 13:10:49 -05:00
Brett Smith
a1f815c60b
template: Improve error detection and reporting in amount expressions.
2017-11-09 17:39:24 -05:00
Brett Smith
e3335aa6ec
setup: Bump version to 0.2.
2017-11-09 16:19:29 -05:00
Brett Smith
093834dd15
template: Support variables in account names.
2017-11-09 16:18:03 -05:00
Brett Smith
e5a0089eb9
importers: Add an importer for Stripe payments.
2017-11-09 16:18:03 -05:00
Brett Smith
f8a68c3a2e
importers: Refactor out a base CSV importer class.
...
I'm going to build the Stripe importer on top of this.
2017-11-09 16:18:03 -05:00
Brett Smith
3b821cbbee
template: Template amounts are now written with fuller expressions.
...
This makes it possible to support transactions that divide funds in
ways other than a simple percentage split. For example, there
might be tax withheld, or a flat fee expense on each transaction.
2017-11-09 16:17:58 -05:00
Brett Smith
cebd1481ec
patreon: Import VAT withholdings.
2017-10-26 12:56:29 -04:00
Brett Smith
dd155749c3
CODE: Document how to run tests.
2017-10-26 12:19:16 -04:00
Brett Smith
6295952a08
main: Remove "None" from error message about importing stdin.
2017-10-26 12:05:57 -04:00
Brett Smith
cc8da9392e
errors: Add UserInputError.__str__.
...
This makes messages look nicer in logs.
2017-10-26 12:04:44 -04:00
Brett Smith
c49371c87e
CODE: Add a high-level overview of the program structure.
2017-10-25 17:17:41 -04:00
Brett Smith
cf4a0e37c1
README: Document how to run import2ledger.
2017-10-25 13:39:22 -04:00
Brett Smith
1aeffa31c5
README: Document template variables.
2017-10-25 13:39:10 -04:00
Brett Smith
176aac35ed
README: Suggest an install line that can upgrade nicely too.
2017-10-25 13:38:54 -04:00
Brett Smith
356f36b039
README: Document configuration.
...
This isn't a complete README, but a start.
2017-10-23 15:25:16 -04:00
Brett Smith
ab9c65d20d
import2ledger: Support only importing entries in a date range.
2017-10-22 16:10:17 -04:00
Brett Smith
b37575eabc
tests: Remove stray debug prints.
2017-10-22 16:08:37 -04:00
Brett Smith
23190c1cdb
setup: Install a script to invoke the module.
2017-10-22 14:31:53 -04:00
Brett Smith
a408c854d4
setup: Don't install tests.
2017-10-22 14:31:38 -04:00
Brett Smith
f888b13c56
hooks.add_entity: Better handle common name prefix parts.
...
Keep these with the name they're attached to, rather than breaking the name
in the middle.
2017-10-22 14:05:56 -04:00
Brett Smith
f0dafcaed9
hooks.add_entity: ASCIIfy stroke characters.
2017-10-22 13:58:18 -04:00
Brett Smith
5c73c40bcc
import2ledger: First version.
...
This is a pretty feature-complete version 1.
I don't know why I waited this long to commit anything.
2017-10-22 13:40:20 -04:00