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

lino_xl.lib.accounting.fields

Database fields for lino_xl.lib.accounting.

Classes

DcAmountField(dc, *args, **kwargs)

An editable virtual PriceField to get and set an amount of a given booking direction (debit or credit).

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

Bases: VirtualField

An editable virtual PriceField to get and set an amount of a given booking direction (debit or credit). It may be used only on models that defines a database field amount.

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.