Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
200 Visualizzazioni

Hello everybody!!!

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

Thanks a lot in advance

Avatar
Abbandona
Autore Risposta migliore

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'),

}

Avatar
Abbandona
Risposta migliore

May be this will help you.

import datetime

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

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
ago 25
2552
1
lug 25
963
1
ago 25
1151
0
mag 25
1405
2
apr 25
3597