Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Best way to inherit states parameter of field

By
Michael Pol
on 3/26/15, 6:06 AM 694 views

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

0

deep

--deep--
1617
| 5 4 7
Bengaluru, India
--deep--

Techno-Functional Associate with 6+ years of experience in Odoo (formerly known as OpenERP).

deep
On 3/27/15, 7:22 AM

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..


0

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
On 3/27/15, 3:00 AM

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.

Michael Pol
on 3/27/15, 3:22 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/26/15, 6:06 AM
Seen: 694 times
Last updated: 3/27/15, 6:20 PM