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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -