From 9fb9b22065cd0129eee8b3dfd440e79693da41f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 23 Mar 2012 18:38:52 +0100 Subject: [PATCH] Integer, Numeric and Float allow None as value NULL value is None and not False issue2022 review237004 --- line.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/line.py b/line.py index a117ca161b..04865be018 100644 --- a/line.py +++ b/line.py @@ -1,6 +1,7 @@ #This file is part of Tryton. The COPYRIGHT file at the top level of #this repository contains the full copyright notices and license terms. import time +from decimal import Decimal from trytond.model import ModelView, ModelSQL, fields from trytond.wizard import Wizard, StateAction from trytond.backend import TableHandler @@ -16,9 +17,9 @@ class Line(ModelSQL, ModelView): name = fields.Char('Name', required=True) debit = fields.Numeric('Debit', digits=(16, Eval('currency_digits', 2)), - depends=['currency_digits']) + required=True, depends=['currency_digits']) credit = fields.Numeric('Credit', digits=(16, Eval('currency_digits', 2)), - depends=['currency_digits']) + required=True, depends=['currency_digits']) currency = fields.Function(fields.Many2One('currency.currency', 'Currency', on_change_with=['move_line']), 'get_currency') currency_digits = fields.Function(fields.Integer('Currency Digits', @@ -65,6 +66,12 @@ class Line(ModelSQL, ModelView): def default_active(self): return True + def default_debit(self): + return Decimal(0) + + def default_credit(self): + return Decimal(0) + def on_change_with_currency(self, vals): move_line_obj = Pool().get('account.move.line') if vals.get('move_line'):