Welcome | Get started | Dive into Lino | Contribute | Topics | Reference | More

lino_xl.lib.ledger.fields

Database fields for lino_xl.lib.ledger.

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: 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.