Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
9724 Представления

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. 


Аватар
Отменить
Лучший ответ

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>

Аватар
Отменить
Related Posts Ответы Просмотры Активность
1
мая 25
4012
1
июн. 17
5192
3
июл. 24
2951
1
нояб. 22
4850
0
мар. 15
3690