In 6.1.1 some readonly fields aren't.

Bug #1083806 reported by Martin Collins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo GTK Client (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

GTK Client 6.1.1
Kubuntu 12.04 and Windows XP

I have a number of fields which are marked readonly using attrs in the view xml, eg.

  <field name="truck_load_gross_weight" attrs="{'readonly':[('permit_write','=',False)]}"/>
  <field name="weigh_gross_datetime" attrs="{'readonly':[('permit_write','=',False)]}"/>

These should (and in 6.0 did) appear grayed out and be uneditable.
In 6.1 they are not grayed out and they are editable.
The integer value is reverted on saving (OK), the date field is not.
If I change 'readonly' to 'invisible' the fields are still displayed.

The web client works as it should.

I won't mark this a security issue but it does mean some of my users can change some data
that they shouldn't be able to.

Revision history for this message
Martin Collins (mkc-steadfast) wrote :

I tracked it down. In 6.0 the server was testing against True. In 6.1 it tests against False. Explicitly setting permit_write to False if it's not True has solved the problem.

Revision history for this message
Colin Ligertwood (colin-zaber) wrote :

Hi Martin

I think I'm trying to track down this same bug in the 6.1 gtk client.

In my case, i'm trying to get read-only fields in a tree view with editable=bottom when the document is not in the draft state. When a document not in the state of draft is opened, the fields in the tree appear to be editable, and my users start editing them, clicking and typing into the cell. Then when they save, the changes are lost, as the fields are actually read-only.

If the tree view is toggled from tree to form and back, the selected record then works as it should. The field is no longer editable within the tree.

As it appears you have solved a similar problem, do you think you could help shed some light on this issue for me?

Thanks!
Colin

Revision history for this message
Martin Collins (mkc-steadfast) wrote :

I don't know about the editable tree view. I have a vague memory of not being able to get it working at all. At any rate, I don't use it.

What I do is in the form view. I have a function field which gets set by a permission checking function. That field is the one checked in the attrs. See this question for more details: https://answers.launchpad.net/openobject-server/+question/178779

Is the state field on the view? If not it needs to be, even if you make it invisible. Check that attrs is getting False when it should be, None doesn't work.

Revision history for this message
Colin Ligertwood (colin-zaber) wrote :

Thanks for your reply, Martin! I appreciate your suggestions. We're trying to get the editable tree view to not allow typing into a field which is set read-only. This only works if the treeview is toggled from tree->form->tree with all rows selected or something like that. After some more poking, I think it's an actual client issue in its use of Gtk TreeView widget.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.