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

I have requirement of modifying sale order workflow. I have added extras state in sale.order class. I want fields to be editable in form on those states. Following is the way we put states parameter in field.

states={'draft': [('readonly', False)], 'sent': [('readonly', False)],'newstate1' : [('readonly', False)]} 

I don't want to override existing fields. Is there any way I can apply states to all fields or selected fields in a class?


Thanks

아바타
취소
베스트 답변

you can change it in the xml view itself by using attributes:

For example:

<field name="your_field" position="attributes">

<attribute name="attrs">{'readonly':['('state',' in',['draft','sent','newstate1']}</attribute>

</field>

아바타
취소
작성자

Thanks Vasant I want to apply through fields definition in py file. The problem is I don't want to write xpath or override for all fields which are there in default modules. This will be hectic. I hope you got my problem.

베스트 답변

Use ORM method "fields_get"

In that you can change/set the property of a field... Try it out, It worked for me..

Refer in standard objects, like account_payment, res_bank etc, in which they have used it to customize the property of fields..


아바타
취소
관련 게시물 답글 화면 활동
3
12월 23
91469
3
9월 21
5394
1
9월 15
9093
4
8월 25
6052
3
7월 23
5935