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

hi ,

How to make readonly button based on condition?

I have two Button

  • Button 1

  • Button 2

 and my condition is if database filed text is "po" then allow Button 1 and filed text "os" then Button 2.

How to apply condition on button based on Database field.

아바타
취소

hi Temur,

I already did this step attrs="{'readonly': [('field_name','=','po')]}".

it's not working dear.

작성자 베스트 답변

it's not work attrs="{'readonly': [('field_name','=','po')]}" or

attrs="{'readonly': [('field_name','=','so')]}".

My button code line is

<button name="button1" states="approve" string="Button 1" type="object" attrs="{'readonly': [('field_name','=','po')]}" icon="gtk-ok" /> 

I am using openerp v5.

아바타
취소
베스트 답변

Best to make button invisible rather than readonly. It will save space on your view and look more user friendly. 

아바타
취소
베스트 답변

add to "Button 2" in xml:

attrs="{'readonly': [('field_name','=','po')]}" 


similar for "Button 1"


아바타
취소