meta_entity: Not required for Equity accounts.

This commit is contained in:
Brett Smith 2020-03-31 15:04:15 -04:00
parent 3aee1efdc1
commit 3a4c8526b2
2 changed files with 2 additions and 1 deletions

View file

@ -39,7 +39,7 @@ class MetaEntity(core.TransactionHook):
if txn_entity_ok is False: if txn_entity_ok is False:
yield errormod.InvalidMetadataError(txn, self.METADATA_KEY, txn_entity) yield errormod.InvalidMetadataError(txn, self.METADATA_KEY, txn_entity)
for post in data.iter_postings(txn): for post in data.iter_postings(txn):
if post.account.is_under('Assets', 'Liabilities'): if post.account.is_under('Assets', 'Equity', 'Liabilities'):
continue continue
entity = post.meta.get(self.METADATA_KEY) entity = post.meta.get(self.METADATA_KEY)
if entity is None: if entity is None:

View file

@ -84,6 +84,7 @@ def test_invalid_values_on_transactions(hook, src_value):
@pytest.mark.parametrize('account,required', [ @pytest.mark.parametrize('account,required', [
('Accrued:AccountsReceivable', True), ('Accrued:AccountsReceivable', True),
('Assets:Cash', False), ('Assets:Cash', False),
('Equity:OpeningBalances', False),
('Expenses:General', True), ('Expenses:General', True),
('Income:Donations', True), ('Income:Donations', True),
('Liabilities:CreditCard', False), ('Liabilities:CreditCard', False),