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. odoo 14 數字輸入動態限制最大值

odoo 14 數字輸入動態限制最大值

Scheduled Pinned Locked Moved Odoo 开发与实施交流
6 Posts 2 Posters 2.4k Views 1 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 Offline
    S Offline
    samchou
    wrote on last edited by samchou
    #1

    請問在表單輸入數字時
    如何設定限制由系統運算出來的最大值

    D 1 Reply Last reply
    0
    • S samchou

      請問在表單輸入數字時
      如何設定限制由系統運算出來的最大值

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

      @samchou 可以在程序中设置constraint,在代码中搜索api.constrains学习对字段设置约束逻辑, 或者利用_sql_constraints参数设置数据库级别的约束。

      这个回答同样适用于你另外一个对时间字段的约束条件

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

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

        你好
        我是想在XML內設置限制最大值
        <field name="wk_qty" attrs="{'invisible': [('note', 'in', ('today','makeup'))]}" widget="numeric_step" options="{'step': 1, 'min': 0, 'max': 100}" / >
        但是現行僅能使用固定值 例如:100
        如何能'max': max_value ?
        動態設定最大值

        D 1 Reply Last reply
        0
        • S samchou

          你好
          我是想在XML內設置限制最大值
          <field name="wk_qty" attrs="{'invisible': [('note', 'in', ('today','makeup'))]}" widget="numeric_step" options="{'step': 1, 'min': 0, 'max': 100}" / >
          但是現行僅能使用固定值 例如:100
          如何能'max': max_value ?
          動態設定最大值

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

          @samchou 为什么一定要在xml里设置?

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

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

            那請問要如何限制在畫面輸入的最大值?

            D 1 Reply Last reply
            0
            • S samchou

              那請問要如何限制在畫面輸入的最大值?

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

              @samchou 我回答过你了呀, https://www.odoo.com/documentation/15.0/developer/howtos/rdtraining/11_constraints.html?highlight=constraint

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

              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