Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
6 Trả lời
8330 Lượt xem

I'm trying to remove the `action_quotation_send` button via a custom module. In my XML I've attempted:

<record id="view_order_form" model="ir.ui.view">

      <field name="name">sale.order.form</field>

      <field name="model">sale.order</field>
      <field name="priority" eval="1"/>
      <field name="inherit_id" ref="sale.view_order_form"/>
      <field name="arch" type="xml">

          <!-- xpath, doesn't work? -->
          <xpath expr="//button[@name='action_quotation_send']" position="attributes">
              <attribute name="attrs">{'invisible': [('func_field', '=', False)]}</attribute>
          </xpath>

          <!-- straight up removal doesn't work? -->

          <button name="action_quotation_send" position="replace"/>

          <!-- Matching the structure of the original XML doesn't work -->

          <form string="Sales Order">
              <header>

                  <button name="action_quotation_send" position="replace"/>
              </header>
          </form>

      </field>
  </record>

What am I missing?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

<xpath expr="//button[@name='action_quotation_send']" position="attributes">

              <attribute name="invisible">1</attribute>

</xpath>

OR

<xpath expr="//button[@name='action_quotation_send']" position="replace">

</xpath>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

<xpath expr="//button[@name='action_quotation_send']" position="replace">
</xpath>


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

<xpath expr="//button[@name='action_quotation_send']" position="attributes">
              <attribute name="invisible">1</attribute>
</xpath>

OR

<xpath expr="//button[@name='action_quotation_send']" position="replace">
</xpath>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

<xpath expr="//button[@name='action_quotation_send']" position="attributes">
              <attribute name="invisible">1</attribute>
</xpath>

OR

<xpath expr="//button[@name='action_quotation_send']" position="replace">
</xpath>

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Have you tried to make the button invisable instead of removing it?  It would accomplish the same thing. 

For example... 

<button name="action_quotation_send" position="replace" invisible="1"/>

Ảnh đại diện
Huỷ bỏ

Yes, better idea, and that way could make invisible base upon Group permissions

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
6165
1
thg 3 15
4507
2
thg 3 15
10000
1
thg 3 24
6644
5
thg 2 23
29587