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

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

Odoo 中文社区

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

Openerp 定时任务设置问题

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
4 帖子 2 发布者 4.0k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • 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
      • mrshellyM 离线
        mrshellyM 离线
        mrshelly
        写于 最后由 编辑
        #3

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

        1 条回复 最后回复
        0

        • 登录

        • 没有帐号? 注册

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