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

Hello, 

I have created some new fields in the Partner module of odoo9. One of the new field is "ident"  that should ONLY show up when the partner type is a company: 

 <field name="ident" attrs="{'invisible':[('company_type', '=', 'person')]}" />

Works good so far: When I create new contact this modification works perfect. Also when I edit an existing contact it works


Here is the problem:

When I install my module on an fresh odoo instance with EXISTING contacts, I observe that when I want to edit this existing contact, the variable "ident" is shown although the contact is a person (not a company). 

Interesting: When I change the contact on the frontend to "company" and change it back to "person" (without saving the form) I see that the effect is correct. 

The problem is that when I have my module fresh installed and edit an existing contact, the variable does not behave as it should (being invisible on first edit of existing parter). After the first edit everything works out, but for a user that wants to install the module on his instance it could be confusing. 

Any ideas on how to load the right behavior on initial loading of the form?

Thanks


아바타
취소
베스트 답변

Hello,

Can you paste the company_type field [I think it is a selection]

Also you can try something like:


attrs="{'invisible':[('company_type', '!=', 'company')]}"
아바타
취소
베스트 답변

When review is select bad option category at a time invisible the field of description.


review = fields.Selection([('good', 'GOOD'),('bad', 'BAD')])

description=fields.Char(readonly=False)

<field name="review"/>

<field name="description" attrs="{'invisible': [('review', '!=', 'good')]}"/>

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

Hi Ahmed, 

I tried both ways '!=' and '='. Both does not work :-(



아바타
취소
관련 게시물 답글 화면 활동
1
3월 15
5866
1
7월 17
3140
1
6월 16
7256
3
2월 16
5916
2
2월 16
6181