Skip to content
  • Categories
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • 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 658 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
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

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

    digitalsatoriD 1 Reply Last reply
    0
    • digitalsatoriD Offline
      digitalsatoriD Offline
      digitalsatori 管理员
      replied to samchou 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 ?
        動態設定最大值

        digitalsatoriD 1 Reply Last reply
        0
        • digitalsatoriD Offline
          digitalsatoriD Offline
          digitalsatori 管理员
          replied to samchou 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

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

            digitalsatoriD 1 Reply Last reply
            0
            • digitalsatoriD Offline
              digitalsatoriD Offline
              digitalsatori 管理员
              replied to samchou 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

              • Login

              • Don't have an account? Register

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