Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3 Replies
25410 Tampilan

Hi all,

I am trying to customize the Product view via inherited view. Currently, there are a few tabs in the Product page: Information/Procurements/Inventory/Sales/Accounting.

We do not need the Sales for now. To avoid the users' confusion, I would like to hide the tab. At first, I tried to delete the page, the system gives error as it seems that other page calls for some information from this tab. Hence I am not able to delete the page. Thus I am thinking whether it's possible to hide the page. I tried to use invisible =1 in the editing tags, but it did not work. Please kindly advise how I could achieve this.

Thanks a lot in advance!

<record model="ir.ui.view" id="moleac_product_form_view">
        <field name="name">Product Inherited View</field>
        <field name="model">product.product</field>
        <field name="inherit_id" ref="product.product_normal_form_view" /> 
            <field name="arch" type="xml">
                <data>
                    <!--Edit Tab Sales-->
                    <xpath expr="/form/sheet/notebook/page[@string='Sales']" invisiable="1"/>   
                </data>
            </field>
    </record>
Avatar
Buang
Jawaban Terbai

This is the final solution:

    <record model="ir.ui.view" id="view_partner_form_jolibelle2">
        <field name="name">res.partner.form.jolibelle2</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="arch" type="xml">
            <page string="Sales & Purchases" position="attributes">
                <attribute name='invisible'>1</attribute> 
            </page>
        </field>
    </record>

And in this way, it works....

Avatar
Buang

Even cleaner would be to use the page name in place of the string. page string is depracated in Odoo V9 and would cause errors.

For Odoo v9 this works for me in Products to hide Accounting page. As this page has no name atrribute.

<xpath expr="//page[5]" position="attributes">

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

</xpath>

Jawaban Terbai


  1. This worked with me
  2. I was trying to hide the different notebook pages on invoice form






Avatar
Buang

<xpath expr="//page[@name='invoice_tab']" position="attributes">
<attribute name='invisible'>1</attribute>
</xpath>
<xpath expr="//page[@name='aml_tab']" position="attributes">
<attribute name='invisible'>1</attribute>
</xpath>

Jawaban Terbai

in not sure about this but try this if this works. After your <data> tag.. call the page..

<page string="Sales" invisible="1"">..

just try if you want, i think you dont need the xpath to do that..

Avatar
Buang
Penulis

I tried with the code before using xPath. unfortunately it did not work for me. It gave validate error:Error occurred while validating the field(s) arch: Invalid XML for View Architecture! . thanks anyway!  I tried to use replace in the parent tag, then invisible as attribute in the child tag.. but it did not work

how about use the field name after page string invisible.. ur one2many, or many2one field.. inside that page.. it works when i tried it <field name="one2many field inside the page " invisible="1"">..

Penulis

thx a lot for trying to help! Finally I found a way to make it work! :] <page string="Sales" position="attributes"> <attribute name='invisible'>1</attribute> </page>

sorry if i didnt help you :(