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

I have field

fields.Char('URL Common', invisible=True)

but it not working.

How i can fix it?

아바타
취소

Make the field invisible through your XML. Either by not calling the field or by saying invisible="1".

베스트 답변

Hi,

Please tell me why do you need it from .py file? You can easily hide the field from XML view file in 3 ways:

1. Using attribute invisible="1", if you just need to hide.

Eg:

<field name="your_field" invisible="1" />;

2. Using attrs, if you need to hide based on a condition.

 Eg:

<field name="total_amount" attrs="{'invisible':[('currency_id','!=',company_id.currency_id)]}"/>;

3. Using security groups, if you want  to display field only to the  members a particular group.

Eg:

<field name="company_id" groups="your_group"/>;
아바타
취소
작성자

Because i want to use python set value on invisible. Exp def _return_invisible(self): wh_hn = self.env.ref('fbv_core.warehouse_hn').pick_type_id.id wh_hcm = self.env.ref('fbv_core.warehouse_hcm').picking_type_id.id return ['|',('picking_type_id', '=', wh_hn), ('picking_type_id', '=', wh_hcm)] and on xml, i don't use get ref id

Then you don't need to call that field in view file, it will be hidden, no need to separately set an attribute in field definition. Or if you want to do something based on the value of inivisible and need to be hidden, then you can call the field with invisible="1" in view file.