Odoo Help


how can set readonly=True for sequence field?

on 6/13/16, 2:37 AM 668 views


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)]}


'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?



Jérémy Kersten (jke)

--Jérémy Kersten (jke)--

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

About This Community

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


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)


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