|
@ -62,16 +62,16 @@ class tile(orm.Model): |
|
|
desc = r.field_id.field_description |
|
|
desc = r.field_id.field_description |
|
|
if r.field_function == 'min': |
|
|
if r.field_function == 'min': |
|
|
value = min(vals) |
|
|
value = min(vals) |
|
|
helper = _("'Minimum value of %s'" % desc) |
|
|
|
|
|
|
|
|
helper = _("Minimum value of '%s'" % desc) |
|
|
elif r.field_function == 'max': |
|
|
elif r.field_function == 'max': |
|
|
value = max(vals) |
|
|
value = max(vals) |
|
|
helper = _("'Maximum value of %s'" % desc) |
|
|
|
|
|
|
|
|
helper = _("Maximum value of '%s'" % desc) |
|
|
elif r.field_function == 'sum': |
|
|
elif r.field_function == 'sum': |
|
|
value = sum(vals) |
|
|
value = sum(vals) |
|
|
helper = _("'Total value of %s'" % desc) |
|
|
|
|
|
|
|
|
helper = _("Total value of '%s'" % desc) |
|
|
elif r.field_function == 'avg': |
|
|
elif r.field_function == 'avg': |
|
|
value = sum(vals) / len(vals) |
|
|
value = sum(vals) / len(vals) |
|
|
helper = _("'Average value of %s'" % desc) |
|
|
|
|
|
|
|
|
helper = _("Average value of '%s'" % desc) |
|
|
res[r.id].update({ |
|
|
res[r.id].update({ |
|
|
'computed_value': value, |
|
|
'computed_value': value, |
|
|
'helper': helper, |
|
|
'helper': helper, |
|
@ -105,7 +105,7 @@ class tile(orm.Model): |
|
|
_get_tile_info, type='float', string='Computed Value', |
|
|
_get_tile_info, type='float', string='Computed Value', |
|
|
multi='tile_info', readonly=True), |
|
|
multi='tile_info', readonly=True), |
|
|
'helper': fields.function( |
|
|
'helper': fields.function( |
|
|
_get_tile_info, type='char', string='Helper', |
|
|
|
|
|
|
|
|
_get_tile_info, type='char', string='Helper Text', |
|
|
multi='tile_info', readonly=True), |
|
|
multi='tile_info', readonly=True), |
|
|
'field_function': fields.selection([ |
|
|
'field_function': fields.selection([ |
|
|
('min', 'Minimum'), |
|
|
('min', 'Minimum'), |
|
@ -142,7 +142,7 @@ class tile(orm.Model): |
|
|
_constraints = [ |
|
|
_constraints = [ |
|
|
( |
|
|
( |
|
|
_check_model_id_field_id, |
|
|
_check_model_id_field_id, |
|
|
"Error ! Please select a field of the select model.", |
|
|
|
|
|
|
|
|
"Error ! Please select a field of the selected model.", |
|
|
['model_id', 'field_id']), |
|
|
['model_id', 'field_id']), |
|
|
( |
|
|
( |
|
|
_check_field_id_field_function, |
|
|
_check_field_id_field_function, |