is there a way to display date field in different format on the view of odoo/openerp ? I tried using function fields as the follow lines:
def _format_date(self, cr, uid, ids, field_name, arg, context=None):
res = {}
for line in self.browse(cr, uid, ids, context=context):
res[line.id]= {
'date_fin':'',
}
print line.id,'date ',str(line.date).replace(',','.')
if line.date:
res[line.id]['date_fin']=line.date #.split()[0]
return res
_columns={
'date_fin': fields.function( _format_date,method=True, string='date fin',
store = {
'stock.move': (lambda self, cr, uid, ids, c={}: ids, ['sale_price_unit','product_uom_qty'], 10),
},
),
}
I get this error:
2015-03-11 09:35:13,539 7075 ERROR db_name openerp.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/opt/odoo/odoo/openerp/http.py", line 518, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/openerp/http.py", line 539, in dispatch
result = self._call_function(**self.params)
...
File "/opt/odoo/odoo/openerp/models.py", line 5237, in <dictcomp>
if name in fields
File "/opt/odoo/odoo/openerp/fields.py", line 1028, in convert_to_cache
return float_round(float(value or 0.0), precision_digits=self.digits[1])
TypeError: float() argument must be a string or a number
do you have any idea of this error