Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
9249 Vistas

Hi Experts,

For example, I have many2one (res.partner) relation in crm.lead, and when in the form view the user clicks "Create and Edit.." link, I wanted to redirect to a simple form (only a few fields eg name, address, etc). Is there such way to customize the view without affecting the rest. 

For instance, for some case I want to enable some flag automatically, and in some cases I want to put some other default values like is company is ticked by default, etc. 


Avatar
Descartar
Mejor respuesta

Try this

By passing form_view_ref: external id of form will load that particular form when you open with it. 
Also, to pass default values, send the value through context 
e.g. context="{'default_name': name}"

 <record model="ir.ui.view" id="crm_case_form_view_oppor_inherit">
            <field name="name">Opportunities</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="//field[@name='partner_id']" position="attributes">
                                <attribute name="context">{'default_name': partner_name, 'default_email': email_from, 'default_phone': phone,'form_view_ref': 'base.view_partner_simple_form','default_is_company': True} </attribute
                     </xpath>
             </field>
</record>

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
may 25
3592
1
jun 17
4778
3
jul 24
2205
1
nov 22
4405
0
mar 15
3254