Changeset - 51eee8ec8fd8
[Not reviewed]
0 3 0
Brett Smith - 4 years ago 2020-11-04 18:43:54
brettcsmith@brettcsmith.org
meta_entity: Don't set transaction metadata when payee is None. RT#12913
3 files changed with 12 insertions and 2 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/plugin/meta_entity.py
Show inline comments
...
 
@@ -73,5 +73,5 @@ class MetaEntity(core.TransactionHook):
 
        if txn_entity_ok is False:
 
            yield errormod.InvalidMetadataError(txn, self.METADATA_KEY, txn_entity)
 
        if txn_entity is txn.payee:
 
        if txn_entity is txn.payee and txn_entity is not None:
 
            txn.meta[self.METADATA_KEY] = txn.payee
 
        for post in data.Posting.from_txn(txn):
setup.py
Show inline comments
...
 
@@ -6,5 +6,5 @@ setup(
 
    name='conservancy_beancount',
 
    description="Plugin, library, and reports for reading Conservancy's books",
 
    version='1.13.0',
 
    version='1.13.1',
 
    author='Software Freedom Conservancy',
 
    author_email='info@sfconservancy.org',
tests/test_meta_entity.py
Show inline comments
...
 
@@ -215,4 +215,14 @@ def test_which_accounts_required_on(hook, account, required):
 
                   for error in errors)
 

	
 
def test_dont_set_entity_none(hook):
 
    txn = testutil.Transaction(postings=[
 
        ('Expenses:Other', 5),
 
        ('Assets:Cash', -5),
 
    ])
 
    assert any(hook.run(txn))
 
    assert 'entity' not in txn.meta
 
    for post in txn.postings:
 
        assert post.meta is None or 'entity' not in post.meta
 

	
 
def test_not_required_on_opening(hook):
 
    txn = testutil.OpeningBalance()
0 comments (0 inline, 0 general)