Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

Rml报表打印出来的时间慢了8小时



  • rml里[[time.strftime('%d-%m-%Y %H:%M:%S')]]
    显示的时间慢了8个小时,有什么方法可以解决这个问题呢?
    openerp是装在CentOS上的。


  • 管理员

    odoo已经帮我们想好办法了:
    report_sxw.py

    &nbsp; &nbsp; <br />def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False):<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assuming &#039;Account&#039; decimal.precision=3:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value) -&gt; digits=2 (default)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value, digits=4) -&gt; digits=4<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value, dp=&#039;Account&#039;) -&gt; digits=3<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value, digits=5, dp=&#039;Account&#039;) -&gt; digits=5<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;<br />
    

    ``` [[formatLang(time.strftime('%d-%m-%Y %H:%M:%S'), date_time=True)]] ```


  • [quote author=Joshua link=topic=16398.msg28054#msg28054 date=1400664076]
    odoo已经帮我们想好办法了:
    report_sxw.py

    &nbsp; &nbsp; <br />def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False, dp=False, currency_obj=False):<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Assuming &#039;Account&#039; decimal.precision=3:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value) -&gt; digits=2 (default)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value, digits=4) -&gt; digits=4<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value, dp=&#039;Account&#039;) -&gt; digits=3<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; formatLang(value, digits=5, dp=&#039;Account&#039;) -&gt; digits=5<br />&nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;&quot;<br />
    

    ``` [[formatLang(time.strftime('%d-%m-%Y %H:%M:%S'), date_time=True)]] ```
    [/quote]

    我在把[[formatLang(time.strftime('%d-%m-%Y %H:%M:%S'), date_time=True)]]放在rml里怎么显示不出时间呢?

  • 管理员

    谢谢提醒,开始没有看清楚,formatLang只接受默认的日期时间格式 '%Y-%m-%d %H:%M:%S',然后再根据你的语言来输出对应的日期格式,所以应该是:

    [[formatLang(time.strftime(&#039;%Y-%m-%d %H:%M:%S&#039;), date_time=True)]]
    


  • [quote author=Joshua link=topic=16398.msg28072#msg28072 date=1401086770]
    谢谢提醒,开始没有看清楚,formatLang只接受默认的日期时间格式 '%Y-%m-%d %H:%M:%S',然后再根据你的语言来输出对应的日期格式,所以应该是:

    [[formatLang(time.strftime(&#039;%Y-%m-%d %H:%M:%S&#039;), date_time=True)]]
    


    [/quote]

    好的,原来是格式的问题啊,现在问题解决了,谢谢啦。


Log in to reply