[IMP]:improve orm for diagram view.

bzr revid: apa@tinyerp.com-20100224114806-s10137rwshuflw3c
This commit is contained in:
apa-tiny 2010-02-24 17:18:06 +05:30
parent ad2ca2cd40
commit c9763d3200
1 changed files with 20 additions and 7 deletions

View File

@ -1186,7 +1186,21 @@ class orm_template(object):
button.set('readonly', str(int(not can_click)))
arch = etree.tostring(node, encoding="utf-8").replace('\t', '')
fields = self.fields_get(cr, user, fields_def.keys(), context)
#code for diagram view.
fields={}
if node.tag=='diagram':
if node.getchildren()[0].tag=='node':
node_fields=self.pool.get(node.getchildren()[0].get('object')).fields_get(cr, user, fields_def.keys(), context)
if node.getchildren()[1].tag=='arrow':
arrow_fields = self.pool.get(node.getchildren()[1].get('object')).fields_get(cr, user, fields_def.keys(), context)
for key,value in node_fields.items():
fields[key]=value
for key,value in arrow_fields.items():
fields[key]=value
else:
fields = self.fields_get(cr, user, fields_def.keys(), context)
for field in fields_def:
if field == 'id':
# sometime, the view may containt the (invisible) field 'id' needed for a domain (when 2 objects have cross references)
@ -1202,7 +1216,6 @@ class orm_template(object):
msg += "\n\nEither you wrongly customised this view, or some modules bringing those views are not compatible with your current data model"
netsvc.Logger().notifyChannel('orm', netsvc.LOG_ERROR, msg)
raise except_orm('View error', msg)
return arch, fields
def __get_default_calendar_view(self):