mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
36 lines
1.3 KiB
Diff
36 lines
1.3 KiB
Diff
|
# HG changeset patch
|
||
|
# User Sergi Almacellas Abellana <sergi@koolpi.com>
|
||
|
Remove all the view elements which the user doesn't have access
|
||
|
|
||
|
issue4487
|
||
|
review10071002
|
||
|
|
||
|
Index: trytond/trytond/model/modelview.py
|
||
|
===================================================================
|
||
|
|
||
|
--- a/trytond/trytond/model/modelview.py
|
||
|
+++ b/trytond/trytond/model/modelview.py
|
||
|
@@ -399,14 +399,15 @@
|
||
|
# Remove field without read access
|
||
|
for field in fields_to_remove:
|
||
|
for element in tree.xpath(
|
||
|
- '//field[@name="%s"] | //label[@name="%s"]'
|
||
|
- % (field, field)):
|
||
|
- if type == 'form':
|
||
|
+ ('//field[@name="%s"] | //label[@name="%s"]'
|
||
|
+ ' | //page[@name="%s"] | //separator[@name="%s"]'
|
||
|
+ ' | //group[@name="%s"]') % ((field,) * 5)):
|
||
|
+ if type == 'tree' or element.tag in ('page', 'group'):
|
||
|
+ parent = element.getparent()
|
||
|
+ parent.remove(element)
|
||
|
+ elif type == 'form':
|
||
|
element.tag = 'label'
|
||
|
element.attrib.clear()
|
||
|
- elif type == 'tree':
|
||
|
- parent = element.getparent()
|
||
|
- parent.remove(element)
|
||
|
|
||
|
if type == 'tree':
|
||
|
ViewTreeWidth = pool.get('ir.ui.view_tree_width')
|
||
|
|