line: contraint für line>=0
This commit is contained in:
parent
acf3ca7ce5
commit
d1bb86ada3
3 changed files with 12 additions and 1 deletions
6
line.py
6
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'),
|
||||
|
|
|
@ -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 #
|
||||
|
|
|
@ -113,6 +113,9 @@ full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_line_invalid_category">
|
||||
<field name="text">The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'.</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_line_must_positive">
|
||||
<field name="text">The amount must be positive.</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
Loading…
Reference in a new issue