This question has been flagged

Hi, i inherited a view from crm and i add a new notebook page, i can't set this page invisible when the stage_id is different 'lost'

can you help me please 

this is my view code 

<record id="view_oppor_form" model="ir.ui.view">
 <field name="name">crm.oppor.form</field>
  <field name="model">crm.lead</field>
 <field name="inherit_id" ref="crm.crm_case_form_view_oppor/>
  <field name="arch" type="xml">
<xpath expr="/form/sheet/notebook/page[@string='Internel notes']" position="after">
                  <fields name="cause_perte"/>
           </xpath>
 </field>
 </record>



Avatar
Discard
Best Answer

Hello Khadhraoui,


Please try below code :-

<record id="view_oppor_form" model="ir.ui.view">
    <field name="name">crm.oppor.form</field>
    <field name="model">crm.lead</field>
    <field name="inherit_id" ref="crm.crm_case_form_view_oppor/>
    <field name="arch" type="xml">
        <xpath expr="/form/sheet/notebook/page[@string='Internel notes']" position="after">
            <page string="Page String" attrs="{'invisible' : [('stage_id.name', '=', 'lost')]}">
                // code of page
            </page>
        </xpath>
    </field> 
 </record>


It means when stage is lost, this page which you add is invisible.


Hope it will helps you.

Thanks,

Avatar
Discard