跳至内容
菜单
此问题已终结
3 回复
7656 查看

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
92100
3
9月 21
5695
1
9月 15
9402
4
8月 25
6867
3
7月 23
6221