跳转至内容
  • 版块
  • 标签
  • 热门
  • 用户
  • 群组
皮肤
  • 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

  • 默认(Flatly)
  • 不使用皮肤
折叠

Odoo 中文社区

  1. 主页
  2. 版块
  3. Odoo 新手求助
  4. [已解决]根据form数据 控制默认按钮(编辑/创建)

[已解决]根据form数据 控制默认按钮(编辑/创建)

已定时 已固定 已锁定 已移动 Odoo 新手求助
6 帖子 5 发布者 4.4k 浏览
  • 从旧到新
  • 从新到旧
  • 最多赞同
登录后回复
此主题已被删除。只有拥有主题管理权限的用户可以查看。
  • L 离线
    L 离线
    l315276651
    写于 最后由 编辑
    #1

    <record id="invoice_form_inherit" model="ir.ui.view">
        <field name="name">invoice.form.inherit</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_form"/>
        <field name="arch" type="xml">
            <xpath expt='//form[@string="Invoice"]' possition='attributes'>

                <!-- Frist intent : nothing happened -->
                <attribute name="edit" attrs="{'invisible:[('state','=','paid')]'}"/>

                <!-- Second intent : edit, always hide -->
                <attribute name="edit" attrs="{'invisible:[('state','=','paid')]'}">false</field>

                <!-- Thirds intent : edit, never hide -->
                <attribute name="edit" attrs="{'invisible:[('state','=','paid')]'}">true</field>
        </field>

    1 条回复 最后回复
    0
    • D 离线
      D 离线
      digitalsatori 管理员
      写于 最后由 编辑
      #2
      attrs=&quot;{&#039;invisible:[(&#039;state&#039;,&#039;=&#039;,&#039;paid&#039;)]&#039;
      

      is not needed

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

      1 条回复 最后回复
      0
      • M 离线
        M 离线
        mrshelly
        写于 最后由 编辑
        #3

        这个还是 py 文件中控制比较好... 默认只读, 某几个状态时 可写.

        G 1 条回复 最后回复
        0
        • G 离线
          G 离线
          guotao0609
          在 回复了 mrshelly 最后由 编辑
          #4

          @mrshelly py里面没法控制吧?

          S 1 条回复 最后回复
          0
          • S 离线
            S 离线
            Siyuan
            在 回复了 guotao0609 最后由 编辑
            #5

            @guotao0609

            真要py文件修改xml还是有办法的,

            read 方法里面获取状态传进context

            field_view_get 方法里面从context 获得当前状态,更新对应的xml

            1 条回复 最后回复
            0

            • 登录

            • 没有帐号? 注册

            • 登录或注册以进行搜索。
            • 第一个帖子
              最后一个帖子
            0
            • 版块
            • 标签
            • 热门
            • 用户
            • 群组