Please review this at http://codereview.appspot.com/3848044/
Affected files:
M tryton/gui/window/view_form/widget_search/float.py
M tryton/gui/window/view_form/widget_search/form.py
Index: tryton/gui/window/view_form/widget_search/float.py
===================================================================
--- a/tryton/gui/window/view_form/widget_search/float.py
+++ b/tryton/gui/window/view_form/widget_search/float.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 locale
+from decimal import Decimal
from integer import Integer
import gettext
@@ -66,3 +67,24 @@
widget.stop_emission('insert-text')
except Exception:
widget.stop_emission('insert-text')
+
+
+class Numeric(Float):
+
+ def _value_get(self):
+ try:
+ value1 = Decimal(str(locale.atof(self.entry1.get_text())))
+ except Exception:
+ value1 = False
+ try:
+ value2 = Decimal(str(locale.atof(self.entry2.get_text())))
+ except Exception:
+ value2 = False
+ res = self._get_clause(value1, value2)
+ print res
+ return res
+
+ def _value_set(self, value):
+ super(Numeric, self)._value_set(value)
+
+ value = property(_value_get, _value_set)
Index: tryton/gui/window/view_form/widget_search/form.py
===================================================================
--- a/tryton/gui/window/view_form/widget_search/form.py
+++ b/tryton/gui/window/view_form/widget_search/form.py
@@ -298,7 +298,7 @@
'date': (calendar.Calendar, 2),
'datetime': (calendar.Calendar, 2),
'float': (float.Float, 2),
- 'numeric': (float.Float, 2),
+ 'numeric': (float.Numeric, 2),
'integer': (integer.Integer, 2),
'biginteger': (integer.Integer, 2),
'selection': (selection.Selection, 2),
--
Cédric Krier
B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Tel: +32 472 54 46 59
Email/Jabber: [email protected]
Website: http://www.b2ck.com/
pgp8rji38IP55.pgp
Description: PGP signature
