Skip to Content
Menu
This question has been flagged
1 Reply
8412 Views

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
Discard
Best Answer

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
Discard
Related Posts Replies Views Activity
2
Mar 23
2902
1
Jun 17
4249
3
Jul 24
858
1
Nov 22
3754
0
Mar 15
2755