python - Formating related datetime field -


i have related datetime field

'expected_date'     : fields.related('picking_id','date',type='datetime', relation='stock.picking', store=true, string="date"), 

then want show field in report, want change format of field using code

'picking_date' : datetime.strftime(datetime.strptime(str(expected_date), '%y-%m-%d %h:%m:%s'),'%d-%m-%y'), 

then got error

time data 'none' not match format '%y-%m-%d %h:%m:%s'

can show me did go wrong? i'm using openerp6

expected_date none str(expected_date) returns string value "none", hence not match error.

you want

'picking_date' : (expected_date not none     , datetime.strftime(datetime.strptime(str(expected_date), '%y-s%m-%d %h:%m:%s'),'%d-%m-%y')     or 'none'), 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -