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账号

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

    Alert 动作要如何做呢 ?

    Odoo 开发与实施交流
    5
    6
    4023
    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.
    • D
      digitalwow last edited by

      在.py 中. 我现在使用跳出讯息方式目前有2种, 都提示讯息..让使用者无法无法做下一步动作..

      1. raise osv.except_osv(('Warning!'),('You cannot validate leaves for employee %s: too few remaining days (%s).') % (record.employee_id.name, leaves_rest))
      2. warning = {
      'title': "Warning for ",
      'message': "Notice : You cannot validate leaves for employee."
      }
      return {'warning': warning}

      目前我想 要的是跳出讯息. 但当做是通知而已...还可以做审批动作.
      很类似 view 的 confirm
      <button name="confirm" string="Confirm" states="accept" icon="gtk-jump-to" confirm="Are you sure Confirm?"/>
      会跳出 alert .

      如何在 py 中做到想要的动作呢 ?

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

        那就用Wizard实现

        【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

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

          [quote author=digitalwow link=topic=4283.msg11675#msg11675 date=1343961234]
          在.py 中. 我现在使用跳出讯息方式目前有2种, 都提示讯息..让使用者无法无法做下一步动作..

          1. raise osv.except_osv(('Warning!'),('You cannot validate leaves for employee %s: too few remaining days (%s).') % (record.employee_id.name, leaves_rest))
          2. warning = {
          'title': "Warning for ",
          'message': "Notice : You cannot validate leaves for employee."
          }
          return {'warning': warning}

          目前我想 要的是跳出讯息. 但当做是通知而已...还可以做审批动作.
          很类似 view 的 confirm
          <button name="confirm" string="Confirm" states="accept" icon="gtk-jump-to" confirm="Are you sure Confirm?"/>
          会跳出 alert .

          如何在 py 中做到想要的动作呢 ?
          [/quote]

          第一种因为是抛出异常了,所以不能继续审批动作;
          第二种就是你所需要的,除了可以提供warning信息以外,实际上也可以同时返回值 return {'warning': warning, 'value': value}

          【上海先安科技】(tony AT openerp.cn)

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

            我知道 return {'warning': warning} 可以在  onchange 里面返回提示信息,

            现在我想在  button 的处理函数完成工作后,也返回一个信息 提示一下,

            刚刚试了return {'warning': warning} ,似乎没有什么反应

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

              warning 仅对 onchange 事件有效...
              按钮点击事件无效...

              不过, 如果一定要玩玩, 似科 系统log 可以尝试一下.

              看看 订单确认时, picking 单生成的提示.

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