[REF/IMP] refectorec the varibale names and added the gantt view, added create ndoe button diable condition

bzr revid: jam@tinyerp.com-20120816125706-h92owusp47t6chl1
This commit is contained in:
Jigar Amin - OpenERP 2012-08-16 18:27:06 +05:30
parent 9698fadbb3
commit 9aca3bac8b
2 changed files with 12 additions and 4 deletions

View File

@ -184,6 +184,7 @@
<rng:define name="diagram">
<rng:element name="diagram">
<rng:optional><rng:attribute name="create" /></rng:optional>
<rng:optional><rng:attribute name="string"/></rng:optional>
<rng:ref name="node"/>
<rng:ref name="arrow"/>
@ -381,6 +382,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>

View File

@ -1824,6 +1824,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)
@ -1831,10 +1835,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'):
for a, b in (('create', 'check_create'), ('delete', 'check_unlink'), ('edit', 'check_write')):
if not node.get(a) and not getattr(self, b)(cr, user, raise_exception=False):
node.set(a, 'false')
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: