Files @ dc2e2d200d70
Branch filter:

Location: NPO-Accounting/conservancy_beancount/conservancy_beancount/plugin/meta_invoice.py

Brett Smith
balance_sheet: Fix logger name.
"""meta_invoice - Validate invoice metadata"""
# 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 <https://www.gnu.org/licenses/>.

from . import core
from .. import data
from .. import errors as errormod
from ..beancount_types import (
    MetaValueEnum,
    Transaction,
)

class MetaInvoice(core._RequireLinksPostingMetadataHook):
    CHECKED_METADATA = ['invoice']
    SKIP_FLAGS = '!'

    def _run_on_post(self, txn: Transaction, post: data.Posting) -> bool:
        return post.account.is_under(
            'Assets:Receivable',
            'Liabilities:Payable',
        ) is not None