[IMP] improve code.
bzr revid: ysa@tinyerp.com-20110711071016-w743le30aujzc80g
This commit is contained in:
@@ -19,7 +19,7 @@ class Export(View):
|
||||
for key, value in fields.items():
|
||||
record = {}
|
||||
|
||||
id = prefix + (prefix and '/' or '') + key
|
||||
id = prefix + (prefix and '_'or '') + key
|
||||
nm = name + (name and '/' or '') + value['string']
|
||||
levels = nm.split('/')
|
||||
levels > 1 and levels.remove(levels[0]) or []
|
||||
@@ -39,7 +39,7 @@ class Export(View):
|
||||
cfields_order.sort(lambda x,y: -cmp(cfields[x].get('string', ''), cfields[y].get('string', '')))
|
||||
children = []
|
||||
for j, fld in enumerate(cfields_order):
|
||||
cid = id + '/' + fld
|
||||
cid = id + '_' + fld
|
||||
cid = cid.replace(' ', '_')
|
||||
children.append(cid)
|
||||
record['children'] = children or []
|
||||
@@ -50,7 +50,7 @@ class Export(View):
|
||||
cfields_order.sort(lambda x,y: -cmp(cfields[x].get('string', ''), cfields[y].get('string', '')))
|
||||
children = []
|
||||
for j, fld in enumerate(cfields_order):
|
||||
cid = id + '/' + fld
|
||||
cid = id + '_' + fld
|
||||
cid = cid.replace(' ', '_')
|
||||
children.append(cid)
|
||||
record['children'] = children or []
|
||||
|
||||
@@ -28,8 +28,7 @@ openerp.base_export.Export = openerp.base.Controller.extend({
|
||||
|
||||
on_click: function(id, result) {
|
||||
var self = this
|
||||
this.field_id = id.split("@");
|
||||
this.field_id = self.field_id[1];
|
||||
this.field_id = id.split("@")[1];
|
||||
var model = ''
|
||||
var prefix = ''
|
||||
var name = ''
|
||||
@@ -53,7 +52,6 @@ openerp.base_export.Export = openerp.base.Controller.extend({
|
||||
var self = this;
|
||||
$('tr #treerow_' + self.field_id).after(QWeb.render('ExportTreeView-Secondary', {'fields': result}));
|
||||
jQuery($.find('img[id ^= parentimg]')).click(function(){
|
||||
self.field_id = this.id
|
||||
self.on_click(this.id, result);
|
||||
|
||||
});
|
||||
|
||||
@@ -94,31 +94,28 @@
|
||||
</t>
|
||||
|
||||
<t t-name="ExportTreeView-Secondary">
|
||||
|
||||
<t t-foreach="fields" t-as="field" >
|
||||
<tr t-att-id="'treerow_' + field.id" class="row">
|
||||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr class="row">
|
||||
<t t-if="(field.level).length >= 1">
|
||||
<t t-foreach="field.level" t-as="level" >
|
||||
<td width="18">&nbsp;</td>
|
||||
</t>
|
||||
</t>
|
||||
<td valign="top" align="left" style="cursor: pointer;" width="18">
|
||||
<t t-if="(field.children).length >= 1">
|
||||
<img t-att-id="'parentimg@' + field.id" src="/base/static/src/img/expand.gif" width="16" height="16" border="0"/>
|
||||
</t>
|
||||
</td>
|
||||
<td valign="top" align="left" style="cursor: pointer;">
|
||||
<a href="javascript: void(0)">
|
||||
<t t-esc="field.string"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" border="0">
|
||||
<tr class="row">
|
||||
<t t-foreach="field.level" t-as="level" >
|
||||
<td width="18">&nbsp;</td>
|
||||
</t>
|
||||
<td valign="top" align="left" style="cursor: pointer;" width="18">
|
||||
<t t-if="(field.children).length >= 1">
|
||||
<img t-att-id="'parentimg@' + field.id" src="/base/static/src/img/expand.gif" width="16" height="16" border="0"/>
|
||||
</t>
|
||||
</td>
|
||||
<td valign="top" align="left" style="cursor: pointer;">
|
||||
<a href="javascript: void(0)">
|
||||
<t t-esc="field.string"/>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
Reference in New Issue
Block a user