Discussion:
[Erp5-dev] "Hiding" modules
Jacek Medrzycki
2007-03-16 12:50:37 UTC
Permalink
Hi.

Our client requires that certain class of users should not see the
Person Module in "ERP5 Modules" dropdown and main screen. However, they
should be able to access Persons to which they have permissions (e.g.,
by the "airplane" button or object jump). I know that is is somehow
silly requirement, but client says seeing the modules would be confusing
to users.
I tried to play with permissions, but It seems that if a user has no
permission to view and access the Person Module, he is not able to
access Person, even if
he has permissions to this particular Person (not very surprising). The
question is: Is there a combination of permissions that hides the module
from the modules dropdown but allowes user to access the object
contained in the module?

regards
Jacek
Yoshinori Okuji
2007-03-23 02:54:28 UTC
Permalink
Post by Jacek Medrzycki
I tried to play with permissions, but It seems that if a user has no
permission to view and access the Person Module, he is not able to
access Person, even if
he has permissions to this particular Person (not very surprising). The
question is: Is there a combination of permissions that hides the module
from the modules dropdown but allowes user to access the object
contained in the module?
In theory, you can only disable the View permission. The problem looks like
the generation of breadcrumbs uses Title, and Title is protected with View.
You can do something like this in breadcrumbs:

if hasattr(obj, 'Title'):
title = obj.Title()
else:
title = 'XXX'
result.append( { 'id' : now[ -1 ]
, 'title' : title
, 'url' : '%s/%s/view' % (portal_url,
'/'.join(now))
}
)

YO
--
Yoshinori Okuji, Nexedi CTO
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Full Featured High End Open Source ERP
http://www.erp5.com
ERP5 Wiki: Developer Zone for ERP5 Community
http://www.erp5.org
Brice LEROY
2007-03-23 10:32:42 UTC
Permalink
Hello,
If you have to much variation category on some product, it could append
sometimes that the packing_list.container_state indicate missing although you
correctly configured your variation on each product. To know if problem is
related to the database variation_text field size I call this script on
product module :

for product in context.objectValues():
var_dict={}
try:
for elt in product.getVariationRangeCategoryList():
base = elt.split("/")[0]
if var_dict.has_key(base):
if var_dict[base] < len(elt):
var_dict[base] = len(elt)
else:
var_dict[base] = len(elt)
if len(var_dict) > 0 :
print 'max variation_text size for product %s is %s '%
(product.getTitle(), sum([x for x in var_dict.values() ]))
except e:
pass
return printed


if nothing append, your product variation configuration is not too large,
else, it could be nessecary to modify the size of variation_text field in
database with the biggest variation_text returned value like :

mysql> ALTER TABLE item MODIFY variation_text VARCHAR(500);
Query OK, ...
Records: ...
mysql> ALTER TABLE movement MODIFY variation_text VARCHAR(500);
Query OK, ...
Records: ...
mysql> ALTER TABLE stock MODIFY variation_text VARCHAR(500);
Query OK, ...
Records: ...

where 500 is your biggest variation_text value

bye ;)
--
Brice LEROY
CWD Sellier / Sellerie de Nontron
Service Informatique
Jean-Paul Smets
2007-03-24 10:24:43 UTC
Permalink
Post by Yoshinori Okuji
Post by Jacek Medrzycki
I tried to play with permissions, but It seems that if a user has no
permission to view and access the Person Module, he is not able to
access Person, even if
he has permissions to this particular Person (not very surprising). The
question is: Is there a combination of permissions that hides the
module from the modules dropdown but allowes user to access the object
contained in the module?
In theory, you can only disable the View permission. The problem looks
like the generation of breadcrumbs uses Title, and Title is protected
title = obj.Title()
or use getTitle() which has appropriate permission.
Post by Yoshinori Okuji
title = 'XXX'
result.append( { 'id' : now[ -1 ]
, 'title' : title
, 'url' : '%s/%s/view' % (portal_url,
'/'.join(now))
}
)
YO
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com
Loading...