Skip to Content
Menu
This question has been flagged
1 Reply
3921 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

Avatar
Discard
Best Answer

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

Avatar
Discard