跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • 浅色
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • 深色
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 开发与实施交流
  4. Openerp 定时任务设置问题

Openerp 定时任务设置问题

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
4 帖子 2 发布者 4.4k 浏览 1 关注中
  • 从旧到新
  • 从新到旧
  • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • J 离线
    J 离线
    jerry79
    发表于 最后由 编辑
    #1

    编写了一个XXX_data.xml文件,用来设置openerp定时任务,如下:

    <br />&lt;data noupdate=&quot;1&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;record forcecreate=&quot;True&quot; id=&quot;ir_cron_scheduler_action&quot; model=&quot;ir.cron&quot;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;name&quot;&gt;Customer Contacts Daily Report&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field eval=&quot;True&quot; name=&quot;active&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;user_id&quot; ref=&quot;base.user_root&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;interval_number&quot;&gt;1&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;interval_type&quot;&gt;days&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field name=&quot;numbercall&quot;&gt;-1&lt;/field&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field eval=&quot;False&quot; name=&quot;doall&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field eval=&quot;&#039;crm.customer.contacts&#039;&quot; name=&quot;model&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field eval=&quot;&#039;daily_report&#039;&quot; name=&quot;function&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;field eval=&quot;&#039;&#039;&quot; name=&quot;args&quot;/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &lt;/record&gt;<br />&nbsp; &nbsp; &lt;/data&gt;<br />
    



    其中daily_report函数中有如下语句:

    <br />def daily_report(self, cr, uid, mail=&#91;],context=None):<br />&nbsp; &nbsp; self.generate_mail(cr, uid, body,mail_type, &quot;;&quot;.join(mail), context)<br />
    


    generate_mail的作用是发送一封邮件,收件地址存储在mail里面

    编写的test文件,中,有如下语句:
    sock.execute(DBNAME, uid, PWD, 'crm.customer.contacts', 'daily_report',['[email protected]'])
    执行test文件没有问题,运行正常,邮件可以正常发送

    在openerp的系统管理中,设置--计划--计划的动作--Customer Contacts Daily Report,在参数那里设置:['[email protected]']
    结果邮件发送时,发送地址被解析成了:j;e;r;r;y;.;z;h;a;n;g;@;g;m;a;i;l;.;c;o;m;
    请问这是怎么回事呢?在xml文件中,eval="''"中,我改了很多情况,如="",="'[]'",="'([])'"等等都不行,参数那里改成,(['[email protected]']),也不行。
    请问应该怎样写才能正确解析呢?
    经测试,这样的代码是正确的:
    m=['[email protected]']
    s=';'.join(m)
    但是如果没有[],就是我遇到的情况,因此是否没有解析到方括号呢?

    1 条回复 最后回复
    0
    • J 离线
      J 离线
      jerry79
      发表于 最后由 编辑
      #2

      最后一句话提醒我自己了,把参数改成[['[email protected]']],我就收到邮件了……

      1 条回复 最后回复
      0
      • M 离线
        M 离线
        mrshelly
        发表于 最后由 编辑
        #3

        😃 自己恭喜一下自己罢....

        1 条回复 最后回复
        0

        你好!看起来您对这段对话很感兴趣,但您还没有一个账号。

        厌倦了每次访问都刷到同样的帖子?您注册账号后,您每次返回时都能精准定位到您上次浏览的位置,并可选择接收新回复通知(通过邮件或推送通知)。您还能收藏书签、为帖子顶,向社区成员表达您的欣赏。

        有了你的建议,这篇帖子会更精彩哦 💗

        注册 登录
        回复
        • 在新帖中回复
        登录后回复
        • 从旧到新
        • 从新到旧
        • 最多赞同


        • 登录

        • 没有帐号? 注册

        • 登录或注册以进行搜索。
        • 第一个帖子
          最后一个帖子
        0
        • 版块
        • 标签
        • 热门
        • 用户
        • 群组