From 97260b4ef0406b5a35760e02843fbb3ba82fcd70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=C3=89vrard?= Date: Fri, 23 Mar 2012 18:38:55 +0100 Subject: [PATCH] Integer, Numeric and Float allow None as value NULL value is None and not False issue2022 review237004 --- currency.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/currency.py b/currency.py index a00eb898a0..eb106fc373 100644 --- a/currency.py +++ b/currency.py @@ -20,15 +20,15 @@ class Currency(ModelSQL, ModelView): on_change_with=['rates']), 'get_rate') rates = fields.One2Many('currency.currency.rate', 'currency', 'Rates') rounding = fields.Numeric('Rounding factor', digits=(12, 6), required=True) - digits = fields.Integer('Display Digits') + digits = fields.Integer('Display Digits', required=True) active = fields.Boolean('Active') # monetary formatting mon_grouping = fields.Char('Grouping', required=True) mon_decimal_point = fields.Char('Decimal Separator', required=True) mon_thousands_sep = fields.Char('Thousands Separator') - p_sign_posn = fields.Integer('Positive Sign Position') - n_sign_posn = fields.Integer('Negative Sign Position') + p_sign_posn = fields.Integer('Positive Sign Position', required=True) + n_sign_posn = fields.Integer('Negative Sign Position', required=True) positive_sign = fields.Char('Positive Sign') negative_sign = fields.Char('Negative Sign') p_cs_precedes = fields.Boolean('Positive Currency Symbol Precedes') @@ -235,6 +235,8 @@ class Rate(ModelSQL, ModelView): self._sql_constraints = [ ('date_currency_uniq', 'UNIQUE(date, currency)', 'A currency can only have one rate by date!'), + ('check_currency_rate', 'CHECK(rate >= 0)', + 'The currency rate must greater than or equal to 0'), ] self._order.insert(0, ('date', 'DESC'))