1、qweb 模板页面以年月日的格式显示时间
<span t-esc="datetime.datetime.strptime(str(inv.invoice_start_date), '%Y-%m-%d %H:%M:%S').strftime('%Y年%m月%d日')"/>
2、上传的excel文件解码
class Excel(models.TransientModel):
_name = "invoice.export"
_description = "excel"
file = fields.Binary('文件')
@api.multi
def addexcel(self):
read = xlrd.open_workbook(file_contents=base64.decodebytes(self.file))
table = read.sheet_by_index(0) # 拿到excel第一个sheet页面
table.nrows # 多少行