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. Many2one的字段,在做选择时,如何能按选择习惯排序,即最常选的,排在最上面

Many2one的字段,在做选择时,如何能按选择习惯排序,即最常选的,排在最上面

Scheduled Pinned Locked Moved Odoo 开发与实施交流
5 Posts 4 Posters 3.0k Views 3 Watching
  • 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.
  • 卓忆卓 Offline
    卓忆卓 Offline
    卓忆
    wrote on last edited by 卓忆
    #1

    使用Odoo六年了,各方面都还算挺满意,
    它对我而言,提供了一个 相对 更“系统”的工具,

    一开始是有个客户提出了这么个 易用性 方面的建议,
    就是 :Many2one的字段,在做选择时,如何能按选择习惯排序;即最常选的,排在最上面;
    或者 自己可以定义 筛选,对 有些 用户来说, 有些 选项 是不会去选的 ;
    那么 就变成 ,不同的 用户 ,对应 不同的 domain ; -
    不知有什么更好的方案么?

    我自己 感受 实现它 还是有一定必要的,
    人在压力下,由于皮质醇的 关系,有时候大脑会短路,😖

    所以 在 这里 问问大家,有没有 实现过的,如果没有,我安排技术试试;
    谢谢大家;

    恬淡

    1 Reply Last reply
    0
    • KevinKongK Offline
      KevinKongK Offline
      KevinKong
      wrote on last edited by
      #2

      给Many2one值加权重,用户每选择一次就在对应的拓展表(用户ID,model_id, id, count)增加一次次数,然后关联排序。

      卓忆卓 1 Reply Last reply
      0
      • KevinKongK KevinKong

        给Many2one值加权重,用户每选择一次就在对应的拓展表(用户ID,model_id, id, count)增加一次次数,然后关联排序。

        卓忆卓 Offline
        卓忆卓 Offline
        卓忆
        wrote on last edited by
        #3

        @KevinKong
        谢谢回复,我们试试看

        恬淡

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JacksonLeeZY
          wrote on last edited by
          #4

          目前能想到的是增加一张表(user_id, model_id, value, count),修改源码中 name_search方法,按照count增加排序,这样做会牺牲空间以及用户搜索的效率,是否可取有待商榷。

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

            将用户选择的记录和次数记录到cookie中,

            前端读取默认的记录的时候先从cookie 中获取

            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