标签:
* 在model中
from datetime import datetime, timedelta
import time
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
上面要引入的包
DEFAULT_SERVER_DATE_FORMAT = "%Y-%m-%d"
DEFAULT_SERVER_TIME_FORMAT = "%H:%M:%S"
DEFAULT_SERVER_DATETIME_FORMAT = "%s %s" % (
DEFAULT_SERVER_DATE_FORMAT,
DEFAULT_SERVER_TIME_FORMAT)
--------
#没有设定日期,就引入系统当天的日期
if not date_order:
date_order = time.strftime(DEFAULT_SERVER_DATE_FORMAT)
* 在视图中
标签:
原文地址:http://www.cnblogs.com/toby2chen/p/5338118.html