Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

finan : Financial vouchers

This document describes the lino_xl.lib.finan plugin. Read The finan plugin before reading this document.

Side note: Code snippets (lines starting with >>>) in this document get tested as part of our development workflow. The following initialization snippet tells you which demo project is being used in this document.

>>> from lino import startup
>>> startup('lino_book.projects.cosi1.settings')
>>> from lino.api.doctest import *
>>> ses = rt.login("robin")
>>> translation.activate('en')

This document is based on the following other specifications:

Payment orders

To configure a journal of payment orders, you set the following fields:

  • voucher_type should be “finan.PaymentOrdersByJournal”

  • partner (“Organization”) should point to the bank where you have the account.

  • dc (Primary booking direction) should be DEBIT because each item should debit (not credit) the partner’s account.

  • account should be your Pending Payment Orders account.

>>> jnl = accounting.Journal.get_by_ref("PMO")
>>> jnl.voucher_type
<accounting.VoucherTypes:finan.PaymentOrdersByJournal>
>>> rt.show("finan.PaymentOrdersByJournal", jnl)
... 
===================== ============ =========== =============== ================ =================== ================
 No.                   Entry date   Narration   Total           Execution date   Accounting period   Workflow
--------------------- ------------ ----------- --------------- ---------------- ------------------- ----------------
 2/2015                13/02/2015               5 626,68                         2015-02             **Registered**
 1/2015                13/01/2015               5 626,48                         2015-01             **Registered**
 12/2014               13/12/2014               6 162,48                         2014-12             **Registered**
 11/2014               13/11/2014               5 569,78                         2014-11             **Registered**
 10/2014               13/10/2014               5 572,28                         2014-10             **Registered**
 9/2014                13/09/2014               5 795,48                         2014-09             **Registered**
 8/2014                13/08/2014               5 570,88                         2014-08             **Registered**
 7/2014                13/07/2014               5 670,27                         2014-07             **Registered**
 6/2014                13/06/2014               5 569,78                         2014-06             **Registered**
 5/2014                13/05/2014               5 572,28                         2014-05             **Registered**
 4/2014                13/04/2014               5 571,08                         2014-04             **Registered**
 3/2014                13/03/2014               5 570,88                         2014-03             **Registered**
 2/2014                13/02/2014               5 570,38                         2014-02             **Registered**
 1/2014                13/01/2014               5 619,78                         2014-01             **Registered**
 **Total (14 rows)**                            **79 068,51**
===================== ============ =========== =============== ================ =================== ================
class lino_xl.lib.finan.PaymentOrder

Django model to represent a payment order.

write_xml()

Write the XML file for the SEPA payment initiation from this payment order.

entry_date

The date of the ledger entry.

execution_date

The execution date of payment order. If this is empty, Lino assumes the entry_date when writing the pain_001.xml file.

total

The total amount. This is automatically computed when you register de voucher.

class lino_xl.lib.finan.PaymentOrderItem

Django model to represent an individual item of a payment order.

class lino_xl.lib.finan.PaymentOrders

The base table of all tables on PaymentOrder.

class lino_xl.lib.finan.ItemsByPaymentOrder

Bank statements

>>> rt.show("finan.BankStatementsByJournal", accounting.Journal.get_by_ref("BNK"))
===================== ============ =============== =============== =================== ================
 No.                   Entry date   Old balance     New balance     Accounting period   Workflow
--------------------- ------------ --------------- --------------- ------------------- ----------------
 2/2015                21/02/2015   6 522,60        6 271,21        2015-02             **Registered**
 1/2015                21/01/2015   8 770,11        6 522,60        2015-01             **Registered**
 12/2014               21/12/2014   9 682,85        8 770,11        2014-12             **Registered**
 11/2014               21/11/2014   8 682,94        9 682,85        2014-11             **Registered**
 10/2014               21/10/2014   4 684,98        8 682,94        2014-10             **Registered**
 9/2014                21/09/2014   1 985,19        4 684,98        2014-09             **Registered**
 8/2014                21/08/2014   2 905,91        1 985,19        2014-08             **Registered**
 7/2014                21/07/2014   5 208,51        2 905,91        2014-07             **Registered**
 6/2014                21/06/2014   6 796,22        5 208,51        2014-06             **Registered**
 5/2014                21/05/2014   3 077,72        6 796,22        2014-05             **Registered**
 4/2014                21/04/2014   -1 851,56       3 077,72        2014-04             **Registered**
 3/2014                21/03/2014   1 636,67        -1 851,56       2014-03             **Registered**
 2/2014                21/02/2014   2 447,53        1 636,67        2014-02             **Registered**
 1/2014                21/01/2014                   2 447,53        2014-01             **Registered**
 **Total (14 rows)**                **60 549,67**   **66 820,88**
===================== ============ =============== =============== =================== ================
class lino_xl.lib.finan.BankStatement

Django model to represent a bank statement.

balance1

The old (or start) balance.

balance2

The new (or end) balance.

class lino_xl.lib.finan.BankStatementItem

Django model to represent an individual item of a bank statement.

class lino_xl.lib.finan.BankStatements

The base table of all tables on BankStatement.

class lino_xl.lib.finan.ItemsByBankStatement

Shows the items of a bank statement.

Cash journals

>>> rt.show("finan.BankStatementsByJournal", accounting.Journal.get_by_ref("CSH"))
No data to display

Journal entries

>>> rt.show("finan.JournalEntriesByJournal", accounting.Journal.get_by_ref("MSC"))
No data to display
>>> rt.show("finan.JournalEntriesByJournal", accounting.Journal.get_by_ref("PRE"))
======== ============ =========== =================== ================
 No.      Entry date   Narration   Accounting period   Workflow
-------- ------------ ----------- ------------------- ----------------
 1/2014   01/01/2014               2014-01             **Registered**
======== ============ =========== =================== ================
class lino_xl.lib.finan.JournalEntry

Django model to represent a journal entry.

class lino_xl.lib.finan.JournalEntryItem

Django model to represent an individual item of a journal entry.

class lino_xl.lib.finan.JournalEntries

The base table of all tables on JournalEntry.

class lino_xl.lib.finan.ItemsByJournalEntry

Shows the items of a journal entry.

Model mixins

class lino_xl.lib.finan.FinancialVoucher

Base class for all financial vouchers.

item_account

The default value to use when FinancialVoucherItem.account of an item is empty.

item_remark

The default value to use when FinancialVoucherItem.remark of an item is empty.

printed
See :attr:`lino_xl.lib.excerpts.mixins.Certifiable.printed`
class lino_xl.lib.finan.FinancialVoucherItem

The base class for the items of all types of financial vouchers (FinancialVoucher).

account

The general account to be used in the primary booking. If this is empty, use item_account of the voucher.

project

The “project” related to this transaction. For example in Lino Welfare this is the client.

partner

The partner account to be used in the primary booking.

In Lino Welfare this field is optional and used only for transactions whose recipient is different from the client. When empty, Lino will book to the client (i.e. project).

amount

The amount to be booked. If this is empty, then the voucher cannot be registered.

dc

The direction of the primary booking to create.

remark

External reference. The description of this transation as seen by the external partner.

seqno
match

An arbitrary string used to group several movements.

A reference to the voucher that caused this voucher entry. For example the match of the payment of an invoice points to that invoice.

In a bank statement you might want to specify an individual date for every item.

class lino_xl.lib.finan.DatedFinancialVoucher

A FinancialVoucher whose items have a date field.

class lino_xl.lib.finan.DatedFinancialVoucherItem

A FinancialVoucherItem with an additional date field.

date

The value date of this item.

Plugin configuration

class lino_xl.lib.finan.Plugin

This Plugin class adds some entries to the Explorer menu. It contains the following additional attributes:

suggest_future_vouchers

Whether to suggest vouchers whose due_date is in the future.

The default value is currently False because some demo fixtures rely on this. But in most cases this should probably be set to True because of course a customer can pay an invoice in advance.

You can specify this for your application:

def setup_plugins(self):
    self.plugins.finan.suggest_future_vouchers = True
    super(Site, self).setup_plugins()

Or, as a local system administrator you can also simply set it after your SITE instantiation:

SITE = Site(globals())
...
SITE.plugins.finan.suggest_future_vouchers = True

Tables

class lino_xl.lib.finan.FinancialVouchers

Base class for the default tables of all financial voucher types (JournalEntries , PaymentOrders and BankStatements).

class lino_xl.lib.finan.ItemsByVoucher

The base table of all tables which display the items of a given voucher.

Booking suggestions

class lino_xl.lib.finan.SuggestionsByVoucher

Shows the suggested items for a given voucher, with a button to fill them into the current voucher.

This is the base class for SuggestionsByJournalEntry SuggestionsByBankStatement and SuggestionsByPaymentOrder who define the class of the master_instance (master)

This is an abstract virtual slave table.

Every row is a DueMovement object.

class lino_xl.lib.finan.SuggestionsByJournalEntry

A SuggestionsByVoucher table for a JournalEntry.

class lino_xl.lib.finan.SuggestionsByPaymentOrder

A SuggestionsByVoucher table for a PaymentOrder.

class lino_xl.lib.finan.SuggestionsByBankStatement

A SuggestionsByVoucher table for a BankStatement.

class lino_xl.lib.finan.SuggestionsByVoucherItem

Displays the payment suggestions for a given voucher item, with a button to fill them into the current item (creating additional items if more than one suggestion was selected).

class lino_xl.lib.finan.SuggestionsByJournalEntryItem
class lino_xl.lib.finan.SuggestionsByPaymentOrderItem

A SuggestionsByVoucherItem table for a PaymentOrderItem.

class lino_xl.lib.finan.SuggestionsByBankStatementItem

A SuggestionsByVoucherItem table for a BankStatementItem.

class lino_xl.lib.finan.ShowSuggestions

Show suggested items for this voucher.

class lino_xl.lib.finan.FillSuggestionsToVoucher

Fill selected suggestions from a SuggestionsByVoucher table into a financial voucher.

This creates one voucher item for each selected row.

class lino_xl.lib.finan.FillSuggestionsToVoucherItem

Fill the selected suggestions as items to the voucher. The first selected suggestion does not create a new item but replaces the item for which it was called.

Template files

pain_001.xml

Used for writing a SEPA payment initiation.

finan/PaymentOrder/pain_001.xml

class lino_xl.lib.finan.FinancialVoucherItemChecker