line: contraint für line>=0
This commit is contained in:
parent
34a4958936
commit
70ef448beb
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'],
|
STATES['readonly'],
|
||||||
Eval('bookingtype', '').in_(['spin', 'spout']),
|
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)),
|
debit = fields.Numeric(string='Debit', digits=(16, Eval('currency_digits', 2)),
|
||||||
required=True, readonly=True, depends=['currency_digits'])
|
required=True, readonly=True, depends=['currency_digits'])
|
||||||
credit = fields.Numeric(string='Credit', digits=(16, Eval('currency_digits', 2)),
|
credit = fields.Numeric(string='Credit', digits=(16, Eval('currency_digits', 2)),
|
||||||
|
@ -183,6 +184,9 @@ class Line(Workflow, ModelSQL, ModelView):
|
||||||
('state_val',
|
('state_val',
|
||||||
Check(t, t.state.in_(['edit', 'check', 'done'])),
|
Check(t, t.state.in_(['edit', 'check', 'done'])),
|
||||||
'cashbook.msg_line_wrong_state_value'),
|
'cashbook.msg_line_wrong_state_value'),
|
||||||
|
('amount_val',
|
||||||
|
Check(t, t.amount >= Decimal('0.0')),
|
||||||
|
'cashbook.msg_line_must_positive'),
|
||||||
])
|
])
|
||||||
cls._transitions |= set((
|
cls._transitions |= set((
|
||||||
('edit', 'check'),
|
('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'."
|
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'."
|
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 #
|
# res.group #
|
||||||
|
|
|
@ -113,6 +113,9 @@ full copyright notices and license terms. -->
|
||||||
<record model="ir.message" id="msg_line_invalid_category">
|
<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>
|
<field name="text">The category of the booking line '%(recname)s' does not match the posting type '%(booktype)s'.</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.message" id="msg_line_must_positive">
|
||||||
|
<field name="text">The amount must be positive.</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|
Loading…
Reference in a new issue