So far I'm trying to get a date field data, translated into text format in OpenERP v7.
I made a function on stock
module, but when I declare this on my xml
view, it returns Undefined
tag, and I can't group line by date anymore.
This is my code:
def _date_(self, cr, uid, ids, fields, arg, context):
x={}
for record in self.browse(cr, uid, ids):
if record.create_date :
a = date.strptime(record.create_date, "%Y-%m-%d")
b = a.strftime("%Y-%m-%d")
x[record.id] = text(b(a))
return x
_columns = {
'create_date': fields.date('Creation Date', readonly=True, select=True),
'date_': fields.function(_date_, type='text', string='date copy', store=True),
And on stock_view.xml
<filter string="Creation" name="groupby_create_date" icon="terp-go-month" domain="[]" context="{'group_by':'date_'}"
It doesn't actually group them, but show 'undefined' tag, and groups all lines without discrimination by month, which is the normal behavior of create_date
date type field, so, how can I achieve this?
I'm making some tests, but I don't see any change on it.
Can someone please shed some light on this?
Thanks in advance!