Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
3346 Vistas

I want to make readonly the JOURNAL ENTRIES in Accounting Tab so that the user can't allow to edit or chage anything in JOURNAL ENTRIES..  Thanks in advance.

Avatar
Descartar

@alcaline for which model / screen - accounting tab you want to perform this operation. You can inherit the view and add the "readonly" attribute to that field. What is your actual goal behind making the field readonly, knowing that a better solution can be delivered.

Mejor respuesta

Few possible solutions...
1. use security options, and restrict writing to model(s) shown on that view fro some users/groups 
-> this will not make form field read only, but will not allow selected user to write anything..(meaning.. he will be able to enter any changes, but if tries to save pop up will notify him that he has no right to write to that models) - this would be fastest and prefered way for me...

2. you can make a copy of view (with different external id, and sequence higher that 16) wich will have all fields readonly,
and modify the action wich opens the view to select wich view (RO/RW) to open according to current user...

or 
3. you can modifiy a view, and put attribute readonly="check_ro()" on every field, where method check_ro return treu/false depending on current user... 

methods 2 and 3 demands more coding, but result in more transparent user expirience ( meaning fields will be actualy shown in ro/rw modes) while method 1 is quick solution, but a bit confusing to users (also providing result you want : fields not writeble)

hope it helps :) 
 

Avatar
Descartar

Based on my experience, you can make new copy of the view just like option 2. and assign the groups that will used that view. There is an attribute that you can use for the XML view to assign it to specific group: .

field name="groups" eval= "[(4, ref('group_cpg_emp_dir_self'))]"

"group_cpg_emp_dir_self" is the xml_id of your group. If it belongs to another module, you need to use the format "module_name.group_xml_id"

Mejor respuesta

As far as I know, you can restrict access per model via Access Right (available in security configuration). So maybe you want to set a group read-only for some view in Accounting Tab and make that group have access right to the model as read-only. Then add the user to this group.

With this setting, all fields in the model will automagically appear read-only.

Avatar
Descartar