accounting.journal_entry.forms package
Submodules
accounting.journal_entry.forms.currency module
The currency sub-forms for the journal entry management.
- accounting.journal_entry.forms.currency.CURRENCY_REQUIRED: DataRequired = <wtforms.validators.DataRequired object>
The validator to check if the currency code is empty.
- class accounting.journal_entry.forms.currency.CashDisbursementCurrencyForm(*args, **kwargs)
Bases:
CurrencyFormThe form to create or edit a currency in a cash disbursement journal entry.
- code = <UnboundField(StringField, (), {'filters': [<function strip_text>], 'validators': [<wtforms.validators.DataRequired object>, <accounting.forms.CurrencyExists object>, <accounting.journal_entry.forms.currency.SameCurrencyAsOriginalLineItems object>, <accounting.journal_entry.forms.currency.KeepCurrencyWhenHavingOffset object>]})>
The currency code.
- debit = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.line_item.DebitLineItemForm'>,), {})>,), {'validators': [<accounting.journal_entry.forms.currency.NeedSomeLineItems object>]})>
The debit line items.
- property debit_errors: list[str | LazyString]
Returns the debit line item errors, without the errors in their sub-forms.
- Returns:
- property debit_total: Decimal
Returns the total amount of the debit line items.
- Returns:
The total amount of the debit line items.
- no = <UnboundField(IntegerField, (), {})>
The order in the journal entry.
- whole_form = <UnboundField(BooleanField, (), {})>
The pseudo field for the whole form validators.
- class accounting.journal_entry.forms.currency.CashReceiptCurrencyForm(*args, **kwargs)
Bases:
CurrencyFormThe form to create or edit a currency in a cash receipt journal entry.
- code = <UnboundField(StringField, (), {'filters': [<function strip_text>], 'validators': [<wtforms.validators.DataRequired object>, <accounting.forms.CurrencyExists object>, <accounting.journal_entry.forms.currency.SameCurrencyAsOriginalLineItems object>, <accounting.journal_entry.forms.currency.KeepCurrencyWhenHavingOffset object>]})>
The currency code.
- credit = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.line_item.CreditLineItemForm'>,), {})>,), {'validators': [<accounting.journal_entry.forms.currency.NeedSomeLineItems object>]})>
The credit line items.
- property credit_errors: list[str | LazyString]
Returns the credit line item errors, without the errors in their sub-forms.
- Returns:
- property credit_total: Decimal
Returns the total amount of the credit line items.
- Returns:
The total amount of the credit line items.
- no = <UnboundField(IntegerField, (), {})>
The order in the journal entry.
- whole_form = <UnboundField(BooleanField, (), {})>
The pseudo field for the whole form validators.
- class accounting.journal_entry.forms.currency.CurrencyForm(*args, **kwargs)
Bases:
FlaskFormThe form to create or edit a currency in a journal entry.
- code = <UnboundField(StringField, (), {})>
The currency code.
- property is_code_locked: bool
Returns whether the currency code should not be changed.
- Returns:
True if the currency code should not be changed, or False otherwise
- property line_items: list[LineItemForm]
Returns the line item sub-forms.
- Returns:
The line item sub-forms.
- no = <UnboundField(IntegerField, (), {})>
The order in the journal entry.
- whole_form = <UnboundField(BooleanField, (), {})>
The pseudo field for the whole form validators.
- class accounting.journal_entry.forms.currency.IsBalanced
Bases:
objectThe validator to check that the total amount of the debit and credit line items are equal.
- class accounting.journal_entry.forms.currency.KeepCurrencyWhenHavingOffset
Bases:
objectThe validator to check if the currency is the same when there is offset.
- class accounting.journal_entry.forms.currency.NeedSomeLineItems
Bases:
objectThe validator to check if there is any line item sub-form.
- class accounting.journal_entry.forms.currency.SameCurrencyAsOriginalLineItems
Bases:
objectThe validator to check if the currency is the same as the original line items.
- class accounting.journal_entry.forms.currency.TransferCurrencyForm(*args, **kwargs)
Bases:
CurrencyFormThe form to create or edit a currency in a transfer journal entry.
- code = <UnboundField(StringField, (), {'filters': [<function strip_text>], 'validators': [<wtforms.validators.DataRequired object>, <accounting.forms.CurrencyExists object>, <accounting.journal_entry.forms.currency.SameCurrencyAsOriginalLineItems object>, <accounting.journal_entry.forms.currency.KeepCurrencyWhenHavingOffset object>]})>
The currency code.
- credit = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.line_item.CreditLineItemForm'>,), {})>,), {'validators': [<accounting.journal_entry.forms.currency.NeedSomeLineItems object>]})>
The credit line items.
- property credit_errors: list[str | LazyString]
Returns the credit line item errors, without the errors in their sub-forms.
- Returns:
- property credit_total: Decimal
Returns the total amount of the credit line items.
- Returns:
The total amount of the credit line items.
- debit = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.line_item.DebitLineItemForm'>,), {})>,), {'validators': [<accounting.journal_entry.forms.currency.NeedSomeLineItems object>]})>
The debit line items.
- property debit_errors: list[str | LazyString]
Returns the debit line item errors, without the errors in their sub-forms.
- Returns:
- property debit_total: Decimal
Returns the total amount of the debit line items.
- Returns:
The total amount of the debit line items.
- no = <UnboundField(IntegerField, (), {})>
The order in the journal entry.
- whole_form = <UnboundField(BooleanField, (), {'validators': [<accounting.journal_entry.forms.currency.IsBalanced object>]})>
The pseudo field for the whole form validators.
accounting.journal_entry.forms.journal_entry module
The journal entry forms for the journal entry management.
- class accounting.journal_entry.forms.journal_entry.CannotDeleteOriginalLineItemsWithOffset
Bases:
objectThe validator to check the original line items with offset.
- class accounting.journal_entry.forms.journal_entry.CashDisbursementJournalEntryForm(*args, **kwargs)
Bases:
JournalEntryFormThe form to create or edit a cash disbursement journal entry.
- currencies = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.currency.CashDisbursementCurrencyForm'>,), {})>,), {'validators': [<accounting.journal_entry.forms.journal_entry.NeedSomeCurrencies object>]})>
The line items categorized by their currencies.
- date = <UnboundField(DateField, (), {'validators': [<wtforms.validators.DataRequired object>, <accounting.journal_entry.forms.journal_entry.NotBeforeOriginalLineItems object>, <accounting.journal_entry.forms.journal_entry.NotAfterOffsetItems object>]})>
The date.
- note = <UnboundField(TextAreaField, (), {'filters': [<function strip_multiline_text>]})>
The note.
- whole_form = <UnboundField(BooleanField, (), {'validators': [<accounting.journal_entry.forms.journal_entry.CannotDeleteOriginalLineItemsWithOffset object>]})>
The pseudo field for the whole form validators.
- class accounting.journal_entry.forms.journal_entry.CashReceiptJournalEntryForm(*args, **kwargs)
Bases:
JournalEntryFormThe form to create or edit a cash receipt journal entry.
- currencies = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.currency.CashReceiptCurrencyForm'>,), {})>,), {'validators': [<accounting.journal_entry.forms.journal_entry.NeedSomeCurrencies object>]})>
The line items categorized by their currencies.
- date = <UnboundField(DateField, (), {'validators': [<wtforms.validators.DataRequired object>, <accounting.journal_entry.forms.journal_entry.NotBeforeOriginalLineItems object>, <accounting.journal_entry.forms.journal_entry.NotAfterOffsetItems object>]})>
The date.
- note = <UnboundField(TextAreaField, (), {'filters': [<function strip_multiline_text>]})>
The note.
- whole_form = <UnboundField(BooleanField, (), {'validators': [<accounting.journal_entry.forms.journal_entry.CannotDeleteOriginalLineItemsWithOffset object>]})>
The pseudo field for the whole form validators.
- accounting.journal_entry.forms.journal_entry.DATE_REQUIRED: DataRequired = <wtforms.validators.DataRequired object>
The validator to check if the date is empty.
- class accounting.journal_entry.forms.journal_entry.JournalEntryForm(*args, **kwargs)
Bases:
FlaskFormThe base form to create or edit a journal entry.
- collector: Type[LineItemCollector]
The line item collector. The default is the base abstract collector only to provide the correct type. The subclass forms should provide their own collectors.
- property credit_account_options: list[AccountOption]
The selectable credit accounts.
- Returns:
The selectable credit accounts.
- currencies = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.currency.CurrencyForm'>,), {})>,), {})>
The line items categorized by their currencies.
- property currencies_errors: list[str | LazyString]
Returns the currency errors, without the errors in their sub-forms.
- Returns:
The currency errors, without the errors in their sub-forms.
- date = <UnboundField(DateField, (), {})>
The date.
- property debit_account_options: list[AccountOption]
The selectable debit accounts.
- Returns:
The selectable debit accounts.
- property description_editor: DescriptionEditor
Returns the description editor.
- Returns:
The description editor.
- is_modified: bool
Whether the journal entry is modified during populate_obj().
- property line_items: list[LineItemForm]
Collects and returns the line item sub-forms.
- Returns:
The line item sub-forms.
- property max_date: date | None
Returns the maximum available date.
- Returns:
The maximum available date.
- property min_date: date | None
Returns the minimal available date.
- Returns:
The minimal available date.
- note = <UnboundField(TextAreaField, (), {})>
The note.
- obj: JournalEntry | None
The journal entry, when editing an existing one.
- property original_line_item_options: list[JournalEntryLineItem]
Returns the selectable original line items.
- Returns:
The selectable original line items.
- populate_obj(obj: JournalEntry) None
Populates the form data into a journal entry object.
- Parameters:
obj – The journal entry object.
- Returns:
None.
- class accounting.journal_entry.forms.journal_entry.LineItemCollector(form: T, obj: JournalEntry)
Bases:
Generic[T],ABCThe line item collector.
- abstract collect() set[int]
Collects the line items.
- Returns:
The ID of the line items to keep.
- to_keep: set[int]
The ID of the existing line items to keep.
- class accounting.journal_entry.forms.journal_entry.NeedSomeCurrencies
Bases:
objectThe validator to check if there is any currency sub-form.
- class accounting.journal_entry.forms.journal_entry.NotAfterOffsetItems
Bases:
objectThe validator to check if the date is not after the offset items.
- class accounting.journal_entry.forms.journal_entry.NotBeforeOriginalLineItems
Bases:
objectThe validator to check if the date is not before the original line items.
- class accounting.journal_entry.forms.journal_entry.T
A journal entry form variant.
alias of TypeVar(‘T’, bound=
JournalEntryForm)
- class accounting.journal_entry.forms.journal_entry.TransferJournalEntryForm(*args, **kwargs)
Bases:
JournalEntryFormThe form to create or edit a transfer journal entry.
- currencies = <UnboundField(FieldList, (<UnboundField(FormField, (<class 'accounting.journal_entry.forms.currency.TransferCurrencyForm'>,), {})>,), {'validators': [<accounting.journal_entry.forms.journal_entry.NeedSomeCurrencies object>]})>
The line items categorized by their currencies.
- date = <UnboundField(DateField, (), {'validators': [<wtforms.validators.DataRequired object>, <accounting.journal_entry.forms.journal_entry.NotBeforeOriginalLineItems object>, <accounting.journal_entry.forms.journal_entry.NotAfterOffsetItems object>]})>
The date.
- note = <UnboundField(TextAreaField, (), {'filters': [<function strip_multiline_text>]})>
The note.
- whole_form = <UnboundField(BooleanField, (), {'validators': [<accounting.journal_entry.forms.journal_entry.CannotDeleteOriginalLineItemsWithOffset object>]})>
The pseudo field for the whole form validators.
accounting.journal_entry.forms.line_item module
The line item sub-forms for the journal entry management.
- class accounting.journal_entry.forms.line_item.CreditLineItemForm(*args, **kwargs)
Bases:
LineItemFormThe form to create or edit a credit line item.
- account_code = <UnboundField(StringField, (), {'filters': [<function strip_text>], 'validators': [<wtforms.validators.DataRequired object>, <accounting.forms.AccountExists object>, <accounting.forms.IsCreditAccount object>, <accounting.journal_entry.forms.line_item.SameAccountAsOriginalLineItem object>, <accounting.journal_entry.forms.line_item.KeepAccountWhenHavingOffset object>, <accounting.journal_entry.forms.line_item.NotStartReceivableFromCredit object>]})>
The account code.
- amount = <UnboundField(DecimalField, (), {'validators': [<accounting.journal_entry.forms.line_item.PositiveAmount object>, <accounting.journal_entry.forms.line_item.NotExceedingOriginalLineItemNetBalance object>, <accounting.journal_entry.forms.line_item.NotLessThanOffsetTotal object>]})>
The amount.
- description = <UnboundField(StringField, (), {'filters': [<function strip_text>]})>
The description.
- id = <UnboundField(IntegerField, (), {})>
The existing line item ID.
- no = <UnboundField(IntegerField, (), {})>
The order in the currency.
- original_line_item_id = <UnboundField(IntegerField, (), {'validators': [<wtforms.validators.Optional object>, <accounting.journal_entry.forms.line_item.OriginalLineItemExists object>, <accounting.journal_entry.forms.line_item.OriginalLineItemOppositeDebitCredit object>, <accounting.journal_entry.forms.line_item.OriginalLineItemNeedOffset object>, <accounting.journal_entry.forms.line_item.OriginalLineItemNotOffset object>]})>
The ID of the original line item.
- populate_obj(obj: JournalEntryLineItem) None
Populates the form data into a line item object.
- Parameters:
obj – The line item object.
- Returns:
None.
- class accounting.journal_entry.forms.line_item.DebitLineItemForm(*args, **kwargs)
Bases:
LineItemFormThe form to create or edit a debit line item.
- account_code = <UnboundField(StringField, (), {'filters': [<function strip_text>], 'validators': [<wtforms.validators.DataRequired object>, <accounting.forms.AccountExists object>, <accounting.forms.IsDebitAccount object>, <accounting.journal_entry.forms.line_item.SameAccountAsOriginalLineItem object>, <accounting.journal_entry.forms.line_item.KeepAccountWhenHavingOffset object>, <accounting.journal_entry.forms.line_item.NotStartPayableFromDebit object>]})>
The account code.
- amount = <UnboundField(DecimalField, (), {'validators': [<accounting.journal_entry.forms.line_item.PositiveAmount object>, <accounting.journal_entry.forms.line_item.NotExceedingOriginalLineItemNetBalance object>, <accounting.journal_entry.forms.line_item.NotLessThanOffsetTotal object>]})>
The amount.
- description = <UnboundField(StringField, (), {'filters': [<function strip_text>]})>
The description.
- id = <UnboundField(IntegerField, (), {})>
The existing line item ID.
- no = <UnboundField(IntegerField, (), {})>
The order in the currency.
- original_line_item_id = <UnboundField(IntegerField, (), {'validators': [<wtforms.validators.Optional object>, <accounting.journal_entry.forms.line_item.OriginalLineItemExists object>, <accounting.journal_entry.forms.line_item.OriginalLineItemOppositeDebitCredit object>, <accounting.journal_entry.forms.line_item.OriginalLineItemNeedOffset object>, <accounting.journal_entry.forms.line_item.OriginalLineItemNotOffset object>]})>
The ID of the original line item.
- populate_obj(obj: JournalEntryLineItem) None
Populates the form data into a line item object.
- Parameters:
obj – The line item object.
- Returns:
None.
- class accounting.journal_entry.forms.line_item.KeepAccountWhenHavingOffset
Bases:
objectThe validator to check if the account is the same when having offset.
- class accounting.journal_entry.forms.line_item.LineItemForm(*args, **kwargs)
Bases:
FlaskFormThe base form to create or edit a line item.
- account_code = <UnboundField(StringField, (), {})>
The account code.
- property account_text: str
Returns the text representation of the account.
- Returns:
The text representation of the account.
- property account_title: str
Returns the title of the account.
- Returns:
The title of the account.
- property all_errors: list[str | LazyString]
Returns all the errors of the form.
- Returns:
All the errors of the form.
- amount = <UnboundField(DecimalField, (), {})>
The amount.
- description = <UnboundField(StringField, (), {})>
The description.
- id = <UnboundField(IntegerField, (), {})>
The existing line item ID.
- property is_need_offset: bool
Returns whether the line item needs offset.
- Returns:
True if the line item needs offset, or False otherwise.
- journal_entry_form: JournalEntryForm | None
The source journal entry form.
- property net_balance: Decimal | None
Returns the net balance.
- Returns:
The net balance.
- no = <UnboundField(IntegerField, (), {})>
The order in the currency.
- property offset_total: Decimal | None
Returns the total amount of the offsets.
- Returns:
The total amount of the offsets.
- property offsets: list[JournalEntryLineItem]
Returns the offsets.
- Returns:
The offsets.
- property original_line_item_date: date | None
Returns the text representation of the original line item.
- Returns:
The text representation of the original line item.
- original_line_item_id = <UnboundField(IntegerField, (), {})>
The Id of the original line item.
- property original_line_item_text: str | None
Returns the text representation of the original line item.
- Returns:
The text representation of the original line item.
- class accounting.journal_entry.forms.line_item.NotExceedingOriginalLineItemNetBalance
Bases:
objectThe validator to check if the amount exceeds the net balance of the original line item.
- class accounting.journal_entry.forms.line_item.NotLessThanOffsetTotal
Bases:
objectThe validator to check if the amount is less than the offset total.
- class accounting.journal_entry.forms.line_item.NotStartPayableFromDebit
Bases:
objectThe validator to check that a payable line item does not start from debit.
- class accounting.journal_entry.forms.line_item.NotStartReceivableFromCredit
Bases:
objectThe validator to check that a receivable line item does not start from credit.
- class accounting.journal_entry.forms.line_item.OriginalLineItemExists
Bases:
objectThe validator to check if the original line item exists.
- class accounting.journal_entry.forms.line_item.OriginalLineItemNeedOffset
Bases:
objectThe validator to check if the original line item needs offset.
- class accounting.journal_entry.forms.line_item.OriginalLineItemNotOffset
Bases:
objectThe validator to check if the original line item is not itself an offset item.
- class accounting.journal_entry.forms.line_item.OriginalLineItemOppositeDebitCredit
Bases:
objectThe validator to check if the original line item is on the opposite debit or credit.
- class accounting.journal_entry.forms.line_item.PositiveAmount
Bases:
objectThe validator to check if the amount is positive.
- class accounting.journal_entry.forms.line_item.SameAccountAsOriginalLineItem
Bases:
objectThe validator to check if the account is the same as the original line item.
accounting.journal_entry.forms.reorder module
The reorder forms for the journal entry management.
- class accounting.journal_entry.forms.reorder.JournalEntryReorderForm(date: date)
Bases:
objectThe form to reorder the journal entries.
- date: date
The date.
- is_modified: bool
Whether the order is modified.
- save_order() None
Saves the order of the account.
- Returns:
- accounting.journal_entry.forms.reorder.sort_journal_entries_in(date: date, exclude: int | None = None) None
Sorts the journal entries under a date after changing the date or deleting a journal entry.
- Parameters:
date – The date of the journal entry.
exclude – The journal entry ID to exclude.
- Returns:
None.
Module contents
The forms for the journal entry management.