diff --git a/line.py b/line.py
index e12e19f..410d5f2 100644
--- a/line.py
+++ b/line.py
@@ -91,7 +91,8 @@ class Line(Workflow, ModelSQL, ModelView):
STATES['readonly'],
Eval('bookingtype', '').in_(['spin', 'spout']),
),
- }, depends=DEPENDS+['currency_digits', 'bookingtype'])
+ }, depends=DEPENDS+['currency_digits', 'bookingtype'],
+ domain=[('amount', '>=', Decimal('0.0'))])
debit = fields.Numeric(string='Debit', digits=(16, Eval('currency_digits', 2)),
required=True, readonly=True, depends=['currency_digits'])
credit = fields.Numeric(string='Credit', digits=(16, Eval('currency_digits', 2)),
@@ -183,6 +184,9 @@ class Line(Workflow, ModelSQL, ModelView):
('state_val',
Check(t, t.state.in_(['edit', 'check', 'done'])),
'cashbook.msg_line_wrong_state_value'),
+ ('amount_val',
+ Check(t, t.amount >= Decimal('0.0')),
+ 'cashbook.msg_line_must_positive'),
])
cls._transitions |= set((
('edit', 'check'),
diff --git a/locale/de.po b/locale/de.po
index e24c014..39e5aaf 100644
--- a/locale/de.po
+++ b/locale/de.po
@@ -150,6 +150,10 @@ msgctxt "model:ir.message,text:msg_line_invalid_category"
msgid "The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'."
msgstr "Die Kategorie der Buchungszeile '%(recname)s' paßt nicht zum Buchungstyp '%(booktype)s'."
+msgctxt "model:ir.message,text:msg_line_must_positive"
+msgid "The amount must be positive."
+msgstr "Der Betrag muß positiv sein."
+
#############
# res.group #
diff --git a/message.xml b/message.xml
index 8fea230..18ce400 100644
--- a/message.xml
+++ b/message.xml
@@ -113,6 +113,9 @@ full copyright notices and license terms. -->
The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'.
+
+ The amount must be positive.
+