lino_xl.lib.ledger.fields

Database fields for lino_xl.lib.ledger.

(This module's source code is available here.)

Classes

DcAmountField(dc, *args, **kwargs)

An editable virtual PriceField to get and set both database fields amount and dc at once.

class lino_xl.lib.ledger.fields.DcAmountField(dc, *args, **kwargs)

Bases: lino.core.fields.VirtualField

An editable virtual PriceField to get and set both database fields amount and dc at once. It may be used only on models which also defines these two fields.

When the amount is positive and dc is DC.debit, return None. When the amount is positive and dc is DC.credit, return amount. When the amount is negative and dc is DC.debit, return -amount. When the amount is negative and dc is DC.credit, return None.