Navigation

    Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

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

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

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

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

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

    OE开发中错误信息的调用

    Odoo 开发与实施交流
    5
    7
    3277
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Q
      qdfulee last edited by

      直接代码

      &nbsp; &nbsp; def dispatch_work_order_reduce_card_times(self,cr,uid,ids,context=None):<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; service_card_id=self.read(cr,uid,ids,[&quot;service_card&quot;],context)[0][&quot;service_card&quot;][0]<br />&nbsp; &nbsp; &nbsp; &nbsp; if service_card_id:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj=self.pool.get(&quot;dispatch.service_card&quot;).read(cr,uid,service_card_id,[&quot;due_date&quot;,&quot;remaining_times&quot;],context)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if obj[&quot;remaining_times&quot;]&lt;1:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; raise osv.except_osv(_(&#039;Error!&#039;), _(&#039;服务卡剩余次数为:0.&#039;))
      
      1 Reply Last reply Reply Quote 0
      • mrshelly
        mrshelly last edited by

        本贴旨在说明什么问题????

        1 Reply Last reply Reply Quote 0
        • D
          d_yang last edited by

          显示一个错误信息的方法。

          1 Reply Last reply Reply Quote 0
          • mrshelly
            mrshelly last edited by

            OK, 看来就是, 如果你要在二次开发OE的过程中 抛出一个异常, 并在客户端显示, 就可以在代码执行的地方 使用

            <br />raise osv.except_osv(_(&#039;Error!&#039;), _(&#039;错误提示信息&#039;))<br />
            



            是这样吗?

            建议给贴子添加上相关的 关键词 tag , 以方便检索.

            1 Reply Last reply Reply Quote 0
            • C
              ccdos last edited by

              请教下 楼上的几位,如过 我仅仅要弹出一个 提示信息,
              而不要 抛出异常,

              应该怎么写 ?

              1 Reply Last reply Reply Quote 0
              • digitalsatori
                digitalsatori 管理员 last edited by

                [检测到链接无效,已移除]

                1 Reply Last reply Reply Quote 0
                • First post
                  Last post