콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
9407 화면

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>

아바타
취소
관련 게시물 답글 화면 활동
1
5월 25
3738
1
6월 17
4920
3
7월 24
2462
1
11월 22
4600
0
3월 15
3446