【问题标题】:odoo statusbar widget visibleodoo 状态栏小部件可见
【发布时间】:2017-06-19 09:18:46
【问题描述】:

如何只显示从选择到状态栏的选定项目。

我继承了一个视图,其中选择只有“草稿”和“已发送”。 然后我添加了“取消”。

state = fields.Selection([
    ('draft', 'Draft'),
    ('sent', 'Sent'),
    ('cancel', 'Cancelled'),
    ]

我只想显示草稿并发送。如何使取消不可见? 或者我怎样才能使选定的项目状态栏不可见?

【问题讨论】:

    标签: xml openerp statusbar


    【解决方案1】:

    在视图中找到所需的状态栏并将其替换为 xpath:

    <record model="ir.ui.view" id="hide_cancel">
        <field name="name">Hides cancel button</field>
        <field name="model">your.model</field>
        <field name="inherit_id" ref="the_view_that_contains_the_statusbar" />
        <field name="arch" type="xml">
            <xpath expr="//field[@name='state']" position="replace">
               <field name="state" widget="statusbar" statusbar_visible="draft,sent"/>
            </xpath>
    
        </field>
    </record>
    

    【讨论】:

      【解决方案2】:

      试试这个

      <field name="state" widget="statusbar" statusbar_visible="draft,sent"/>
      

      【讨论】:

      • 其实已经有选择'state'只有'draft'和'sent'。我继承了它的视图并添加了一个新状态“取消”......现在取消状态栏将显示......我不知道如何使状态栏中的取消不可见。
      • 那么请在您的问题中完整描述。请更新您的问题。
      猜你喜欢
      • 2012-07-25
      • 2021-05-12
      • 2021-09-27
      • 1970-01-01
      • 2016-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多