Odoo 中文社区

    • 注册
    • 登录
    • 搜索
    • 版块
    • 标签
    • 热门
    • 用户
    • 群组

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

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

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

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

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

    Openerp 定时任务设置问题

    Odoo 开发与实施交流
    2
    4
    3850
    正在加载更多帖子
    • 从旧到新
    • 从新到旧
    • 最多赞同
    回复
    • 在新帖中回复
    登录后回复
    此主题已被删除。只有拥有主题管理权限的用户可以查看。
    • J
      jerry79 最后由 编辑

      编写了一个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
        jerry79 最后由 编辑

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

        1 条回复 最后回复 回复 引用 0
        • mrshelly
          mrshelly 最后由 编辑

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

          1 条回复 最后回复 回复 引用 0
          • First post
            Last post