odoo里用sql语句说为日期date类型,没有转换为字符串。

开始我以为是日期now没有转换为string,一直在转换

  now = time.strftime("%Y-%m-%d %H:%M:%S")
            param = (now, id)
            # 第一次上传时间确定注意date日期一定要用引号才是字符串
            a = self.env.cr.execute(
                "update dycrm_khsx set upltim = '%s' where khmc_khsx = %s" % param)

后来才发现upltim=’%s‘在sql这里加上引号就可以了。

猜你喜欢

转载自blog.csdn.net/zzzhhy/article/details/82718606