跳至内容
菜单
此问题已终结
2 回复
193 查看

Hello everybody!!!

Please who can help me  how to convert DATETIME field in odoo v8 to TIMESTAMP.

Thanks a lot in advance

形象
丢弃
编写者 最佳答案

Here is what i have done.

But it doesnt work.

Help please


def _totimestamp(self, cr, uid, ids, field_name, arg, context=None):

res = {}

for record in self.browse(cr, uid, ids, context=context):

res[record.id] = datetime.datetime.fromtimestamp(date_start)

return res

class project_cdr(osv.osv):

_name = 'project.cdr'

_description = 'Recuperation'

_columns = {

'project': fields.many2one('callity_project', string= 'Project_Name'),

'date_start': fields.datetime( 'Date Start', help='Date Start'),

'date_change': fields.function( _totimestamp,'Date change'),

'date_stop': fields.datetime( 'Date Stop', help='Date Stop'),

}

形象
丢弃
最佳答案

May be this will help you.

import datetime

datetime.datetime.fromtimestamp(SPECIFY FLOAT VALUE OF DATE)

形象
丢弃
相关帖文 回复 查看 活动
2
8月 25
2547
1
7月 25
961
1
8月 25
1151
0
5月 25
1403
2
4月 25
3595