[MERGE] trunk-access-ui-jam (in fields_view_get, add attributes in top element when user cannot create/edit/delete)
bzr revid: rco@openerp.com-20120905093337-jkfbdkg1eqrau629
This commit is contained in:
@@ -172,6 +172,9 @@
|
||||
<rng:define name="form">
|
||||
<rng:element name="form">
|
||||
<rng:ref name="overload"/>
|
||||
<rng:optional><rng:attribute name="create" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="delete" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="edit" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="string"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="type"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="link"/></rng:optional>
|
||||
@@ -181,7 +184,8 @@
|
||||
|
||||
<rng:define name="diagram">
|
||||
<rng:element name="diagram">
|
||||
<rng:optional><rng:attribute name="string"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="create" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="string"/></rng:optional>
|
||||
<rng:ref name="node"/>
|
||||
<rng:ref name="arrow"/>
|
||||
<rng:zeroOrMore>
|
||||
@@ -223,6 +227,8 @@
|
||||
<rng:attribute name="default_group_by" />
|
||||
</rng:optional>
|
||||
<rng:optional><rng:attribute name="create" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="delete" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="edit" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="quick_create" /></rng:optional>
|
||||
<rng:zeroOrMore>
|
||||
<rng:ref name="field"/>
|
||||
@@ -238,6 +244,9 @@
|
||||
<rng:define name="tree">
|
||||
<rng:element name="tree">
|
||||
<rng:ref name="overload"/>
|
||||
<rng:optional><rng:attribute name="create" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="delete" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="edit" /></rng:optional>
|
||||
<rng:optional><rng:attribute name="string"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="colors"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="fonts"/></rng:optional>
|
||||
@@ -376,6 +385,9 @@
|
||||
<rng:value>5years</rng:value>
|
||||
</rng:choice></rng:attribute>
|
||||
</rng:optional>
|
||||
<rng:optional><rng:attribute name="create"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="delete"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="edit"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="color"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="date_delay"/></rng:optional>
|
||||
<rng:optional><rng:attribute name="day_length"/></rng:optional>
|
||||
|
||||
@@ -1825,6 +1825,10 @@ class BaseModel(object):
|
||||
if node.getchildren()[0].tag == 'node':
|
||||
node_fields = self.pool.get(node.getchildren()[0].get('object')).fields_get(cr, user, None, context)
|
||||
fields.update(node_fields)
|
||||
if not node.get("create"):
|
||||
fn = getattr(self.pool.get(node.getchildren()[1].get('object')), 'check_create')
|
||||
if not fn(cr, user, raise_exception=False):
|
||||
node.set("create", 'false')
|
||||
if node.getchildren()[1].tag == 'arrow':
|
||||
arrow_fields = self.pool.get(node.getchildren()[1].get('object')).fields_get(cr, user, None, context)
|
||||
fields.update(arrow_fields)
|
||||
@@ -1832,6 +1836,10 @@ class BaseModel(object):
|
||||
fields = self.fields_get(cr, user, None, context)
|
||||
fields_def = self.__view_look_dom(cr, user, node, view_id, False, fields, context=context)
|
||||
node = self._disable_workflow_buttons(cr, user, node)
|
||||
if node.tag in ('kanban', 'tree', 'form', 'gantt'):
|
||||
for action, fn in (('create', 'check_create'), ('delete', 'check_unlink'), ('edit', 'check_write')):
|
||||
if not node.get(action) and not getattr(self, fn)(cr, user, raise_exception=False):
|
||||
node.set(action, 'false')
|
||||
arch = etree.tostring(node, encoding="utf-8").replace('\t', '')
|
||||
for k in fields.keys():
|
||||
if k not in fields_def:
|
||||
|
||||
Reference in New Issue
Block a user