Handle new numeric type and fix interger in tree view
This commit is contained in:
1 parent
87eac895e4
commit
03a49fc375
6 files changed
+9
-2
No files matched your search
@@ -363,6 +363,7 @@ TYPES = {
|
||||
'float_time': FloatField,
|
||||
'integer' : IntegerField,
|
||||
'float' : FloatField,
|
||||
'numeric' : FloatField,
|
||||
'many2one' : M2OField,
|
||||
'many2many' : M2MField,
|
||||
'one2many' : O2MField,
|
||||
|
||||
@@ -598,6 +598,7 @@ WIDGETS_TYPE = {
|
||||
'date': (Calendar, 1, False, False),
|
||||
'datetime': (DateTime, 1, False, False),
|
||||
'float': (Float, 1, False, False),
|
||||
'numeric': (Float, 1, False, False),
|
||||
'integer': (Integer, 1, False, False),
|
||||
'selection': (Selection, 1, False, False),
|
||||
'char': (Char, 1, False, False),
|
||||
|
||||
@@ -494,6 +494,7 @@ CELLTYPES = {
|
||||
'many2many': M2M,
|
||||
'selection': Selection,
|
||||
'float': Float,
|
||||
'numeric': Float,
|
||||
'float_time': FloatTime,
|
||||
'integer': Int,
|
||||
'datetime': Datetime,
|
||||
|
||||
@@ -290,6 +290,7 @@ WIDGETS_TYPE = {
|
||||
'date': (calendar.Calendar, 2),
|
||||
'datetime': (calendar.Calendar, 2),
|
||||
'float': (float.Float, 2),
|
||||
'numeric': (float.Float, 2),
|
||||
'integer': (integer.Integer, 2),
|
||||
'selection': (selection.Selection, 2),
|
||||
'many2one_selection': (selection.Selection, 2),
|
||||
|
||||
@@ -38,7 +38,7 @@ class Parse(object):
|
||||
|
||||
cell = gtk.CellRendererText()
|
||||
cell.set_fixed_height_from_font(1)
|
||||
if field_type == 'float':
|
||||
if field_type in ('float', 'numeric', 'integer'):
|
||||
cell.set_property('xalign', 1.0)
|
||||
column.pack_start(cell, expand=False)
|
||||
column.add_attribute(cell, 'text', self.pos)
|
||||
|
||||
@@ -104,11 +104,14 @@ class ViewTreeModel(gtk.GenericTreeModel, gtk.TreeSortable):
|
||||
if obj[field]:
|
||||
obj[field] = dict(self.fields_type[field]['selection']
|
||||
).get(obj[field],'')
|
||||
if self.fields_type[field]['type'] in ('float',):
|
||||
if self.fields_type[field]['type'] in ('float', 'numeric'):
|
||||
digit = self.fields_type[field].get('digits', (16, 2))[1]
|
||||
for obj in res_ids:
|
||||
obj[field] = locale.format('%.' + str(digit) + 'f',
|
||||
obj[field] or 0.0, True)
|
||||
if self.fields_type[field]['type'] in ('interger',):
|
||||
for obj in res_ids:
|
||||
obj[field] = locale.format('%d', obj[field] or 0, True)
|
||||
if self.fields_type[field]['type'] in ('float_time',):
|
||||
for obj in res_ids:
|
||||
val = '%02d:%02d' % (math.floor(abs(obj[field])),
|
||||
|
||||
Reference in new issue
Block a user