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. 二开过程中新增了计算字段如果历史数据很多升级超级慢,大家是怎么克服的?

二开过程中新增了计算字段如果历史数据很多升级超级慢,大家是怎么克服的?

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

    fields1 = fields.Char(string="xxxxxxx", compute="_compute_xxxxxxxx", store=True)

    这种情况,大家怎么克服的?
    或者说有没有其他方法来处理这个需求?

    期待先安科技的老师指点。

    Z 1 Reply Last reply
    0
    • Z zerone40

      fields1 = fields.Char(string="xxxxxxx", compute="_compute_xxxxxxxx", store=True)

      这种情况,大家怎么克服的?
      或者说有没有其他方法来处理这个需求?

      期待先安科技的老师指点。

      Z Offline
      Z Offline
      zerone40
      wrote on last edited by
      #2

      @digitalsatori 先安科技的老师救救我

      D 1 Reply Last reply
      0
      • Z zerone40

        @digitalsatori 先安科技的老师救救我

        D Offline
        D Offline
        digitalsatori
        管理员
        wrote on last edited by
        #3

        @zerone40 要看你的这个fields1字段是派什么用场的,以及这个compute字段是怎么写的,依赖的模型和字段是什么?

        【上海先安科技】(tony AT openerp.cn)

        Z 1 Reply Last reply
        0
        • D digitalsatori

          @zerone40 要看你的这个fields1字段是派什么用场的,以及这个compute字段是怎么写的,依赖的模型和字段是什么?

          Z Offline
          Z Offline
          zerone40
          wrote on last edited by
          #4

          @digitalsatori

          作用仅仅是为了计算出一个值 展示在视图上。

          compute 方法也很简单

          @api.depends("partner_id.email")
          def _compute_partner_info(self):
              for record in self:
                  record.info = f"{record.name}<{partner_id.email}>" 
          

          非常简单,如果有历史数据 4万条,升级时计算就已经很慢了

          R 1 Reply Last reply
          0
          • Z zerone40

            @digitalsatori

            作用仅仅是为了计算出一个值 展示在视图上。

            compute 方法也很简单

            @api.depends("partner_id.email")
            def _compute_partner_info(self):
                for record in self:
                    record.info = f"{record.name}<{partner_id.email}>" 
            

            非常简单,如果有历史数据 4万条,升级时计算就已经很慢了

            R Offline
            R Offline
            ryanhex53
            wrote on last edited by
            #5

            @zerone40 不要写store=True这个参数不就好了嘛

            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