• 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • 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 中文社区

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

已定时 已固定 已锁定 已移动 Odoo 开发与实施交流
4 帖子 2 发布者 1691 浏览
    • 从旧到新
    • 从新到旧
    • 最多赞同
回复
  • 在新帖中回复
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • L 离线
    L 离线
    lipeng260
    写于 最后由 编辑
    #1

    请教,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 条回复 最后回复
    0
  • 静静静 离线
    静静静 离线
    静静
    写于 最后由 编辑
    #2

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

        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 条回复 最后回复
    0
  • L 离线
    L 离线
    lipeng260
    写于 最后由 编辑
    #3

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

    1 条回复 最后回复
    0

  • 登录

  • 没有帐号? 注册

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

  • 没有帐号? 注册

  • 登录或注册以进行搜索。