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

how can set readonly=True for sequence field?

By
nasim
on 6/13/16, 2:37 AM 213 views

hi

I want set "readonly=True" for a sequence field in every states, for example, for in sale order form : "order reference" field.

in .py code:

'name': fields.char('Order Reference', size=64, required=True, readonly=True, states={'draft': [('readonly', False)]}, select=True),


I delete ------> states={'draft': [('readonly', False)]}

so:

'name': fields.char('Order Reference', size=64, required=True, readonly=True,  select=True),

but when I restart server and check this field: field is grade, but when I create a sale order , the "order refrence" field is for example "SO/001" but when save so, this field change to "SO/002" and the same

"SO/003"  when save , this field change to "SO/004"

so always all of Odd numbers or even numbers is lost.

I don't know what is problem?


Thanks

0

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2993
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 6/13/16, 6:39 AM

readonly don't sent info to server... so probably regenerated...


Maybe you should let this field in write-mode and hidden it.

And display a related in readonly mode. It could work...


To remind...: an onchange which trigger a new value for one field read-only, will be not saved ... 

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

2 follower(s)

Stats

Asked: 6/13/16, 2:37 AM
Seen: 213 times
Last updated: 6/13/16, 6:39 AM