diff --git a/conservancy_beancount/plugin/meta_payable_documentation.py b/conservancy_beancount/plugin/meta_payable_documentation.py new file mode 100644 index 0000000000000000000000000000000000000000..b100ff5896d4371a6b292985d42d7046315f6805 --- /dev/null +++ b/conservancy_beancount/plugin/meta_payable_documentation.py @@ -0,0 +1,32 @@ +"""meta_payable_documentation - Validate payables have supporting docs""" +# Copyright © 2020 Brett Smith +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + +from . import core +from .. import config as configmod +from .. import data +from .. import errors as errormod +from ..beancount_types import ( + Transaction, +) + +class MetaPayableDocumentation(core._RequireLinksPostingMetadataHook): + CHECKED_METADATA = ['invoice', 'contract'] + + def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool: + if post.account.is_under('Liabilities:Payable'): + return not post.is_credit() + else: + return False