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

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

    请教,按钮事件返回warning问题???????

    Odoo 开发与实施交流
    2
    4
    1609
    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.
    • L
      lipeng260 last edited by

      请教,form中增加了一个button,返回一个warning消息,没有反映,翻阅前台js代码,发现并没有相关判断代码,本来打算include解决加入代码,总感觉这种方法不好,发现可以执行action,于是修改代码返回ir.actions.client,功能实现了,窗口提示完毕后,原来点据已经跳转了,原页面一片空白。请教更好解决方法。
      [quote]@api.multi
          def generate_tender(self):
              if self.tender_ids.ids.len() or self.sporadic_ids.ids.len():
                  warning = {
                      'title': "Warning!",
                      'message': "the available num Can't be more than the num",
                  }
                  return {"type": "ir.actions.client",
                          "tag": "bs.warning",
                          "context": {'warning': warning}}[/quote]

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

        系统中的一个例子,也不太懂。 

            def change_password(self, cr, uid, old_passwd, new_passwd, context=None):
                """Change current user password. Old password must be provided explicitly
                to prevent hijacking an existing user session, or for cases where the cleartext
                password is not used to authenticate requests.

                :return: True
                :raise: openerp.exceptions.AccessDenied when old password is wrong
                :raise: except_osv when new password is not set or empty
                """
                self.check(cr.dbname, uid, old_passwd)
                if new_passwd:
                    return self.write(cr, uid, uid, {'password': new_passwd})
                raise osv.except_osv(_('Warning!'), _("Setting empty passwords is not allowed for security reasons!"))

        def preference_change_password(self, cr, uid, ids, context=None):
                return {
                    'type': 'ir.actions.client',
                    'tag': 'change_password',
                    'target': 'new',
                }

        1 Reply Last reply Reply Quote 0
        • L
          lipeng260 last edited by

          raise osv.except_osv(_('Warning!'), _("Setting empty passwords is not allowed for security reasons!")),这个效果不错,谢谢了

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