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

I want to make address fields(street, city, state, zip) required, I used the following 3 type of codes but none of them work for me 

1) <field name="zip" placeholder="ZIP" required="1"/>

2) <field name="zip" placeholder="ZIP" use="required" />

3) <field name="zip" placeholder="ZIP" use="required"><attribute name="required">True</attribute></field>

Source Code

<group>
<field name="parent_id" invisible="1"/>
<field name="seller" invisible="1"/>
<group>
<label for="street" string="Address"/>
<div>
<field name="street" placeholder="Street"/>
<field name="street2"/>
<div class="address_format">
<field name="city" placeholder="City"/>
<field name="state_id" class="oe_no_button" placeholder="State" options="{"no_open": True, "no_create": True}"/>
<field name="zip" placeholder="ZIP"/>
</div>
<field name="country_id" placeholder="Country" class="oe_no_button" options="{"no_open": True, "no_create": True}"/>
</div>
<field name="website" widget="url" placeholder="e.g. www.odoo.com"/>
</group>
<group>
<field name="phone" placeholder="e.g. +32.81.81.37.00"/>
<field name="mobile"/>
<field name="user_ids" invisible="1"/>
<field name="email" widget="email" attrs="{'required': [('user_ids','!=', [])]}" readonly="1"/>
<field name="title" options="{"no_open": True,"no_create": True}"/>
</group>
</group>


아바타
취소
작성자 베스트 답변

@Haresh Kansara , Thank you! 

This was an inherited form. I just use required="1" and it's working fine for me

아바타
취소
베스트 답변

Hi Muhammad Arslan,

I have just analyse your issue for field require,

To set required field you just need to set attribute required="1" and you have added perfectly in point-1.

Make sure, if you have inherited form, then perfectly added code or is there any other inherited form that block your feature, because you have added perfectly.

Also i have found that the source form that you have mention above is not exist in odoo. Is this, this one form from the module: l10_mx_edi 

l10_mx_edi.mx_partner_address_form

아바타
취소
관련 게시물 답글 화면 활동
1
11월 23
2785
0
9월 21
2875
1
3월 15
7354
2
9월 23
9976
0
6월 22
1837