Skip to content
  • Categories
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • 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

  • Default (Flatly)
  • No Skin
Collapse

Odoo 中文社区

  1. Home
  2. Categories
  3. Odoo 新手求助
  4. tree视图增加全局按钮

tree视图增加全局按钮

Scheduled Pinned Locked Moved Odoo 新手求助
3 Posts 3 Posters 5.0k Views
  • 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.
  • B Offline
    B Offline
    BraidTim
    wrote on last edited by
    #1

    之前有提到过在tree视图增加类似Module Immediate install的按钮
    想问一下,这里按钮是基于某条或数条记录来调用函数的吧?也就是不点记录就没有这个菜单吧?
    如果要像http://shine-it.net/assets/uploads/files/1492077694112-upload-ef9f94b8-477f-481e-be40-6e5773403f0a.png
    这种和记录无关的函数的按钮应该怎么写?
    比如我想加一个按钮快速跳转到其它界面来方便用户操作
    有人提到过扩展list_view/form_view,buttons或sidebar,请问有没有什么例子?

    1 Reply Last reply
    0
    • JoshuaJ Offline
      JoshuaJ Offline
      Joshua
      管理员
      wrote on last edited by
      #2

      odoo自带的模块base_import可以满足你的要求,你这里显示的“导入”按钮,就是通过这个模块来添加进来的

          <t t-name="ImportView.import_button">
              <button t-if='widget.options.import_enabled' type="button" class="btn btn-sm btn-default o_button_import">
                  Import
              </button>
          </t>
          <t t-extend="ListView.buttons">
              <t t-jquery="button.o_list_button_add" t-operation="after">
                 <t t-call="ImportView.import_button"/>
              </t>
          </t>
          <t t-extend="KanbanView.buttons">
              <t t-jquery="button.o-kanban-button-new" t-operation="after">
                  <t t-call="ImportView.import_button"/>
              </t>
          </t>
      
      

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

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Siyuan
        wrote on last edited by
        #3

        参考base_import 加按钮,

        Listview 的 js 代码 render_buttons 里面注册新加按钮的监听事件,

        在监听事件里通过 sesssion.rpc 回掉后台对应的方法,

        在方法里写action,传给监听事件,

        通过 do_action(action) 方法进行页面跳转。-_-

        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Tags
        • Popular
        • Users
        • Groups