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. view中怎么用domain筛选user的当前公司

view中怎么用domain筛选user的当前公司

Scheduled Pinned Locked Moved Odoo 开发与实施交流
5 Posts 5 Posters 4.5k Views 5 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.
  • S
    S
    sidi113
    wrote on last edited by
    #1

    请哪位高手指导下,谢谢
    view中怎么用domain筛选user的当前公司current company
    下面这样写报错。还有domain里面运算符后面能调用模型里面的方法么?

    ..............
    [('company_id', '=' , self.env.user.company_id)]

    Eillion DeamonE 1 Reply Last reply
    0
    • G
      G
      ghotiv
      wrote on last edited by
      #2

      context里面default_*这样赋值

      1 Reply Last reply
      0
      • S sidi113

        请哪位高手指导下,谢谢
        view中怎么用domain筛选user的当前公司current company
        下面这样写报错。还有domain里面运算符后面能调用模型里面的方法么?

        ..............
        [('company_id', '=' , self.env.user.company_id)]

        Eillion DeamonE
        Eillion DeamonE
        Eillion Deamon
        wrote on last edited by
        #3

        @sidi113
        如果不介意的话,可以写一个m2o的compute字段,辅助view里的domain逻辑。如果要限制domain的话,最好可以在search_read方法里做逻辑,写在py中不是更好吗?

        Thanks & Best Regards
        Eillion Deamon
        Odoo Technology Center
        HAND Enterprise Solutions Company Ltd

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

          楼上给的是一个解决思路,@sidi113 不过建议直接添加记录规则Record Rule实现,因为这是全局的权限控制。

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

          ieitzybI 1 Reply Last reply
          0
          • JoshuaJ Joshua

            楼上给的是一个解决思路,@sidi113 不过建议直接添加记录规则Record Rule实现,因为这是全局的权限控制。

            ieitzybI
            ieitzybI
            ieitzyb
            wrote on last edited by
            #5

            @joshua 在 view中怎么用domain筛选user的当前公司 中说:

            楼上给的是一个解决思路,@sidi113 不过建议直接添加记录规则Record Rule实现,因为这是全局的权限控制。

            全局,可以在指定 的应用吧?😵

            http://www.OuduPLM.com/ 苏州欧度软件,专注服装行业(鳴謝:37signals,Trello,ProcessON,重庆慧积,上海开阖)

            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