[MERGE]merge main view editor branch upto 871 revision.
bzr revid: kch@tinyerp.com-20110927131705-x1je8pg2peg7apar bzr revid: kch@tinyerp.com-20111004054216-qt2vfni9t3b60s6q
This commit is contained in:
commit
87436d725e
|
@ -1,6 +1,29 @@
|
||||||
openerp.web.view_editor = function(openerp) {
|
openerp.web.view_editor = function(openerp) {
|
||||||
|
var _PROPERTIES = {
|
||||||
|
'field' : ['name', 'string', 'required', 'readonly', 'select', 'domain', 'context', 'nolabel', 'completion',
|
||||||
|
'colspan', 'widget', 'eval', 'ref', 'on_change', 'attrs', 'groups'],
|
||||||
|
'form' : ['string', 'col', 'link'],
|
||||||
|
'notebook' : ['colspan', 'position', 'groups'],
|
||||||
|
'page' : ['string', 'states', 'attrs', 'groups'],
|
||||||
|
'group' : ['string', 'col', 'colspan', 'states', 'attrs', 'groups'],
|
||||||
|
'image' : ['filename', 'width', 'height', 'groups'],
|
||||||
|
'separator' : ['string', 'colspan', 'groups'],
|
||||||
|
'label': ['string', 'align', 'colspan', 'groups'],
|
||||||
|
'button': ['name', 'string', 'icon', 'type', 'states', 'readonly', 'special', 'target', 'confirm', 'context', 'attrs', 'groups'],
|
||||||
|
'newline' : [],
|
||||||
|
'hpaned': ['position', 'groups'],
|
||||||
|
'vpaned': ['position', 'groups'],
|
||||||
|
'child1' : ['groups'],
|
||||||
|
'child2' : ['groups'],
|
||||||
|
'action' : ['name', 'string', 'colspan', 'groups'],
|
||||||
|
'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows'],
|
||||||
|
'graph' : ['string', 'type'],
|
||||||
|
'calendar' : ['string', 'date_start', 'date_stop', 'date_delay', 'day_length', 'color', 'mode'],
|
||||||
|
'view' : [],
|
||||||
|
};
|
||||||
var QWeb = openerp.web.qweb;
|
var QWeb = openerp.web.qweb;
|
||||||
openerp.web.ViewEditor = openerp.web.Widget.extend({
|
openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
|
|
||||||
init: function(parent, element_id, dataset, view, options) {
|
init: function(parent, element_id, dataset, view, options) {
|
||||||
this._super(parent);
|
this._super(parent);
|
||||||
this.element_id = element_id
|
this.element_id = element_id
|
||||||
|
@ -9,55 +32,55 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
this.model = dataset.model;
|
this.model = dataset.model;
|
||||||
this.xml_id = 0;
|
this.xml_id = 0;
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function() {
|
start: function() {
|
||||||
this.View_editor();
|
this.View_editor();
|
||||||
},
|
},
|
||||||
|
|
||||||
View_editor : function(){
|
View_editor : function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
var action = {
|
var action = {
|
||||||
name:'ViewEditor',
|
name:'ViewEditor',
|
||||||
context:this.session.user_context,
|
context:this.session.user_context,
|
||||||
domain: [["model", "=", this.dataset.model]],
|
domain: [["model", "=", this.dataset.model]],
|
||||||
res_model: 'ir.ui.view',
|
res_model : 'ir.ui.view',
|
||||||
views : [[false, 'list']],
|
views : [[false, 'list']],
|
||||||
type: 'ir.actions.act_window',
|
type: 'ir.actions.act_window',
|
||||||
target: "current",
|
target: "current",
|
||||||
limit : 80,
|
limit : 80,
|
||||||
auto_search : true,
|
auto_search : true,
|
||||||
flags: {
|
flags: {
|
||||||
sidebar: false,
|
sidebar: false,
|
||||||
views_switcher: false,
|
views_switcher: false,
|
||||||
action_buttons:false,
|
action_buttons:false,
|
||||||
search_view:false,
|
search_view:false,
|
||||||
pager:false,
|
pager:false,
|
||||||
radio:true
|
radio:true
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
var action_manager = new openerp.web.ActionManager(this);
|
var action_manager = new openerp.web.ActionManager(this);
|
||||||
this.dialog = new openerp.web.Dialog(this,{
|
this.dialog = new openerp.web.Dialog(this,{
|
||||||
modal: true,
|
modal: true,
|
||||||
title: 'ViewEditor',
|
title: 'ViewEditor',
|
||||||
width: 750,
|
width: 750,
|
||||||
height: 500,
|
height: 500,
|
||||||
buttons: {
|
buttons: {
|
||||||
"Create": function(){
|
"Create": function(){
|
||||||
|
//to do
|
||||||
},
|
},
|
||||||
"Edit": function(){
|
"Edit": function(){
|
||||||
self.xml_id = 0 ;
|
self.xml_id = 0 ;
|
||||||
self.get_data();
|
self.get_data();
|
||||||
|
},
|
||||||
},
|
"Close": function(){
|
||||||
"Close": function(){
|
$(this).dialog('destroy');
|
||||||
$(this).dialog('destroy');
|
}
|
||||||
}
|
},
|
||||||
},
|
});
|
||||||
|
this.dialog.start();
|
||||||
});
|
this.dialog.open();
|
||||||
this.dialog.start();
|
action_manager.appendTo(this.dialog);
|
||||||
this.dialog.open();
|
action_manager.do_action(action);
|
||||||
action_manager.appendTo(this.dialog);
|
|
||||||
action_manager.do_action(action);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
check_attr:function(xml,tag,level){
|
check_attr:function(xml,tag,level){
|
||||||
|
@ -65,22 +88,27 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
obj.child_id = [];
|
obj.child_id = [];
|
||||||
obj.id = this.xml_id++;
|
obj.id = this.xml_id++;
|
||||||
obj.level = level;
|
obj.level = level;
|
||||||
|
var vidhin = xml;
|
||||||
var att_list = [];
|
var att_list = [];
|
||||||
var name1 = "<" + tag;
|
var render_name = "<" + tag;
|
||||||
|
var xml_tag = "<" + tag;
|
||||||
$(xml).each(function() {
|
$(xml).each(function() {
|
||||||
att_list = this.attributes;
|
att_list = this.attributes;
|
||||||
att_list = _.select(att_list, function(attrs){
|
att_list = _.select(att_list, function(attrs){
|
||||||
if (tag != 'button'){
|
xml_tag += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';
|
||||||
if(attrs.nodeName == "string" || attrs.nodeName == "name" || attrs.nodeName == "index"){
|
if (tag != 'button'){
|
||||||
name1 += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
|
if(attrs.nodeName == "string" || attrs.nodeName == "name" || attrs.nodeName == "index"){
|
||||||
}else{
|
render_name += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
|
||||||
if(attrs.nodeName == "name"){
|
}else{
|
||||||
name1 += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
|
if(attrs.nodeName == "name"){
|
||||||
}
|
render_name += ' ' +attrs.nodeName+'='+'"'+attrs.nodeValue+'"';}
|
||||||
});
|
}
|
||||||
name1+= ">";
|
});
|
||||||
});
|
render_name+= ">";
|
||||||
obj.name = name1;
|
xml_tag+= ">";
|
||||||
|
});
|
||||||
|
obj.main_xml = xml_tag;
|
||||||
|
obj.name = render_name;
|
||||||
return obj;
|
return obj;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -89,13 +117,13 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
var check_id = parent_list[0];
|
var check_id = parent_list[0];
|
||||||
var p_list = parent_list.slice(1);
|
var p_list = parent_list.slice(1);
|
||||||
if(val.child_id.length != 0){
|
if(val.child_id.length != 0){
|
||||||
$.each(val.child_id, function(key,val) {
|
$.each(val.child_id, function(key,val) {
|
||||||
if(val.id==check_id){
|
if(val.id==check_id){
|
||||||
if(p_list.length!=0){
|
if(p_list.length!=0){
|
||||||
self.save_object(val,p_list,child_obj_list);
|
self.save_object(val,p_list,child_obj_list);
|
||||||
}else{
|
}else{
|
||||||
val.child_id = child_obj_list;
|
val.child_id = child_obj_list;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -112,40 +140,129 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
var main_object = main_object;
|
var main_object = main_object;
|
||||||
var children_list = $(xml).filter(root).children();
|
var children_list = $(xml).filter(root).children();
|
||||||
var parents = $(children_list[0]).parents().get();
|
var parents = $(children_list[0]).parents().get();
|
||||||
_.each(children_list, function(child_node){
|
_.each(children_list, function(child_node){
|
||||||
var string = self.check_attr(child_node,child_node.tagName.toLowerCase(),parents.length);
|
var string = self.check_attr(child_node,child_node.tagName.toLowerCase(),parents.length);
|
||||||
child_obj_list.push(string);
|
child_obj_list.push(string);
|
||||||
});
|
});
|
||||||
|
|
||||||
if(children_list.length != 0){
|
if(children_list.length != 0){
|
||||||
var child_ids = _.map(child_obj_list ,function(num){return num.id;});
|
var child_ids = _.map(child_obj_list ,function(num){return num.id;});
|
||||||
parent_child_id.push({'key': parent_id, 'value': child_ids});
|
parent_child_id.push({'key': parent_id, 'value': child_ids});
|
||||||
var parents = $(children_list[0]).parents().get();
|
var parents = $(children_list[0]).parents().get();
|
||||||
if(parents.length <= parent_list.length){
|
if(parents.length <= parent_list.length){
|
||||||
parent_list.splice(parents.length-1);}
|
parent_list.splice(parents.length-1);
|
||||||
|
}
|
||||||
parent_list.push(parent_id);
|
parent_list.push(parent_id);
|
||||||
$.each(main_object, function(key,val) {
|
$.each(main_object, function(key,val) {
|
||||||
self.save_object(val,parent_list.slice(1),child_obj_list);
|
self.save_object(val,parent_list.slice(1),child_obj_list);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i=0;i<children_list.length;i++){
|
for(var i=0;i<children_list.length;i++){
|
||||||
self.children_function
|
self.children_function
|
||||||
(children_list[i],children_list[i].tagName.toLowerCase(),parent_list,child_obj_list[i].id,main_object,parent_child_id);
|
(children_list[i],children_list[i].tagName.toLowerCase(),
|
||||||
|
parent_list,child_obj_list[i].id,main_object,parent_child_id);
|
||||||
}
|
}
|
||||||
return {"main_object":main_object,"parent_child_id":parent_child_id};
|
return {"main_object":main_object,"parent_child_id":parent_child_id};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
parse_xml :function(arch,view_id){
|
||||||
|
var self = this;
|
||||||
|
var root = $(arch).filter(":first")[0];
|
||||||
|
var tag = root.tagName.toLowerCase();
|
||||||
|
var root_object = self.check_attr(root,tag,this.xml_id);
|
||||||
|
return self.children_function(arch,tag,[],this.xml_id-1,[root_object],[]);
|
||||||
|
},
|
||||||
|
|
||||||
get_data : function(){
|
get_data : function(){
|
||||||
var self = this;
|
var self = this;
|
||||||
var view_id =(($("input[name='radiogroup']:checked").parent()).parent()).attr('data-id');
|
var view_id =(($("input[name='radiogroup']:checked").parent()).parent()).attr('data-id');
|
||||||
var ve_dataset = new openerp.web.DataSet(this,'ir.ui.view');
|
var ve_dataset = new openerp.web.DataSet(this,'ir.ui.view');
|
||||||
ve_dataset.read_ids([parseInt(view_id)],['arch'],function (arch){
|
ve_dataset.read_ids([parseInt(view_id)],['arch'],function (arch){
|
||||||
var arch = arch[0].arch;
|
one_object = self.parse_xml(arch[0].arch,view_id);
|
||||||
var root = $(arch).filter(":first")[0];
|
one_object.arch = arch[0].arch;
|
||||||
var tag = root.tagName.toLowerCase();
|
dataset = new openerp.web.DataSetSearch(self,'ir.ui.view', null, null);
|
||||||
var root_object = self.check_attr(root,tag,0);
|
dataset.read_slice([],{domain : [['inherit_id','=',parseInt(view_id)]]},function (result) {
|
||||||
var one_object = self.children_function(arch,tag,[],0,[root_object],[]);
|
_.each(result,function(res){
|
||||||
return self.edit_view(one_object);
|
self.inherit_view(one_object,res);
|
||||||
});
|
});
|
||||||
|
return self.edit_view(one_object);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
inherit_view : function(one_object,result){
|
||||||
|
var self = this;
|
||||||
|
var root = $(result.arch).filter('*');
|
||||||
|
var xpath_list = [];
|
||||||
|
var part_expr = [];
|
||||||
|
var position ;
|
||||||
|
if(root[0].tagName.toLowerCase() == "data"){
|
||||||
|
_.each($(root).find('xpath'),function(xpath){
|
||||||
|
xpath_list.push(xpath);
|
||||||
|
});
|
||||||
|
} else if(root[0].tagName.toLowerCase() == "xpath"){
|
||||||
|
xpath_list.push(root[0]);
|
||||||
|
}
|
||||||
|
_.each(xpath_list,function(element){
|
||||||
|
var xpath_object = self.parse_xml(element,result.id);
|
||||||
|
var expr = $(element).attr('expr');
|
||||||
|
var position = $(element).attr('position');
|
||||||
|
part_expr = expr.split("/");
|
||||||
|
if(part_expr[0]=="" && part_expr[1]==""){
|
||||||
|
part_expr = part_expr.splice(2);
|
||||||
|
}else if(part_expr[0]==""){
|
||||||
|
part_expr = part_expr.splice(1);
|
||||||
|
}
|
||||||
|
if(part_expr[part_expr.length-1].search("@")!=-1){
|
||||||
|
var part = part_expr[part_expr.length-1];
|
||||||
|
var xpath_list = $.trim(part.replace(/[^a-zA-Z 0-9 _]+/g,' ')).split(" ");
|
||||||
|
one_object['parent_child_id'].push(xpath_object['parent_child_id'][0]);
|
||||||
|
$.each(one_object['main_object'], function(key,val) {
|
||||||
|
var id = self.search_object(val,xpath_list,[],position,xpath_object['main_object'],[]);
|
||||||
|
_.detect(one_object['parent_child_id'],function(res){
|
||||||
|
if(res.key==id){
|
||||||
|
res.value.push(xpath_object['main_object'][0].id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
search_object:function(val,list,p_list,position,xpath_object,r_list){
|
||||||
|
var self = this;
|
||||||
|
var return_list = r_list;
|
||||||
|
var main_list = $.trim(val.name.replace(/[^a-zA-Z 0-9 _]+/g,' ')).split(" ");
|
||||||
|
var insert = _.intersection(main_list,list);
|
||||||
|
var check = _.indexOf(p_list.child_id,xpath_object[0]);
|
||||||
|
if(check == -1){
|
||||||
|
if(insert.length == list.length){
|
||||||
|
var level = val.level;
|
||||||
|
$.each(xpath_object, function(key,val) {
|
||||||
|
self.increase_level(val,level)
|
||||||
|
});
|
||||||
|
var index = _.indexOf(p_list.child_id,val);
|
||||||
|
if(position == "before"){
|
||||||
|
if(index!=0){index--;}
|
||||||
|
}else if(position == "after"){
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
p_list.child_id.splice(index,0,xpath_object[0]);
|
||||||
|
return_list.push(p_list.id);
|
||||||
|
}else{
|
||||||
|
if(val.child_id.length!=0){p_list = val;}
|
||||||
|
$.each(val.child_id, function(key,val) {
|
||||||
|
self.search_object(val,list,p_list,position,xpath_object,return_list);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return return_list;
|
||||||
|
},
|
||||||
|
increase_level :function(val,level){
|
||||||
|
var self = this;
|
||||||
|
val.level = level;
|
||||||
|
$.each(val.child_id, function(key,val) {
|
||||||
|
self.increase_level(val,level+1);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
edit_view : function(one_object){
|
edit_view : function(one_object){
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -155,58 +272,115 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
width: 750,
|
width: 750,
|
||||||
height: 500,
|
height: 500,
|
||||||
buttons: {
|
buttons: {
|
||||||
"Inherited View": function(){
|
"Inherited View": function(){
|
||||||
|
//todo
|
||||||
},
|
},
|
||||||
"Preview": function(){
|
"Preview": function(){
|
||||||
|
//todo
|
||||||
},
|
},
|
||||||
"Close": function(){
|
"Close": function(){
|
||||||
$(this).dialog('destroy');
|
$(this).dialog('destroy');
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
this.dialog.start().open();
|
|
||||||
this.dialog.$element.html(QWeb.render('view_editor', {
|
|
||||||
'data': one_object['main_object'],
|
|
||||||
}));
|
|
||||||
|
|
||||||
$("tr[id^='viewedit-']").click(function() {
|
|
||||||
$("tr[id^='viewedit-']").removeClass('ui-selected');
|
|
||||||
$(this).addClass('ui-selected');
|
|
||||||
});
|
|
||||||
|
|
||||||
$("img[id^='parentimg-']").click(function() {
|
|
||||||
if ($(this).attr('src') == '/web/static/src/img/collapse.gif'){
|
|
||||||
$(this).attr('src', '/web/static/src/img/expand.gif');
|
|
||||||
self.on_expand(this);
|
|
||||||
}else{
|
|
||||||
$(this).attr('src', '/web/static/src/img/collapse.gif');
|
|
||||||
self.on_collapse(this,one_object['parent_child_id']);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
this.dialog.start().open();
|
||||||
|
this.dialog.$element.html(QWeb.render('view_editor', {
|
||||||
|
'data': one_object['main_object'],
|
||||||
|
}));
|
||||||
|
|
||||||
|
$("tr[id^='viewedit-']").click(function() {
|
||||||
|
$("tr[id^='viewedit-']").removeClass('ui-selected');
|
||||||
|
$(this).addClass('ui-selected');
|
||||||
|
});
|
||||||
|
|
||||||
|
$("img[id^='parentimg-']").click(function() {
|
||||||
|
if ($(this).attr('src') == '/web/static/src/img/collapse.gif'){
|
||||||
|
$(this).attr('src', '/web/static/src/img/expand.gif');
|
||||||
|
self.on_expand(this);
|
||||||
|
}else{
|
||||||
|
$(this).attr('src', '/web/static/src/img/collapse.gif');
|
||||||
|
var id = this.id.split('-')[1];
|
||||||
|
self.on_collapse(this,one_object['parent_child_id'],one_object['main_object']);
|
||||||
|
}
|
||||||
|
});
|
||||||
$("img[id^='side-']").click(function() {
|
$("img[id^='side-']").click(function() {
|
||||||
var side = $(this).closest("'tr[id^='viewedit-']'");
|
var side = $(this).closest("tr[id^='viewedit-']")
|
||||||
|
var id_tr = (side.attr('id')).split('-')[1];
|
||||||
|
var img = side.find("img[id='parentimg-"+id_tr+"']").attr('src'); ;
|
||||||
|
var level = side.attr('level');
|
||||||
|
var list_shift =[];
|
||||||
|
var last_tr;
|
||||||
|
var cur_tr = side;
|
||||||
|
list_shift.push(side);
|
||||||
|
var next_tr;
|
||||||
switch (this.id)
|
switch (this.id)
|
||||||
{
|
{
|
||||||
case "side-add":
|
case "side-add":
|
||||||
break;
|
break;
|
||||||
case "side-remove":
|
case "side-remove":
|
||||||
break;
|
break;
|
||||||
case "side-edit":
|
case "side-edit":
|
||||||
break;
|
break;
|
||||||
case "side-up":
|
case "side-up":
|
||||||
if(side.prev().attr('level') == side.attr('level')){
|
while(1){
|
||||||
console.log();
|
var prev_tr = cur_tr.prev();
|
||||||
$(side.prev()).before(side);
|
if(level >= prev_tr.attr('level') || prev_tr.length==0){
|
||||||
}
|
last_tr = prev_tr;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
cur_tr = prev_tr;
|
||||||
|
}
|
||||||
|
if(img){
|
||||||
|
while(1){
|
||||||
|
next_tr = side.next();
|
||||||
|
if(next_tr.attr('level') <= level || next_tr.length==0){
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
list_shift.push(next_tr);
|
||||||
|
side = next_tr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(last_tr.length!=0 && last_tr.attr('level') == level){
|
||||||
|
_.each(list_shift,function(rec){
|
||||||
|
$(last_tr).before(rec);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "side-down":
|
case "side-down":
|
||||||
if(side.next().attr('level') == side.attr('level')){
|
if(img){
|
||||||
var v = side.next().next().attr('level')
|
while(1){
|
||||||
$(side.next()).after(side);
|
next_tr = cur_tr.next();
|
||||||
|
if(next_tr.attr('level') <= level || next_tr.length==0){
|
||||||
|
last_tr = next_tr;
|
||||||
|
break;
|
||||||
|
}else{
|
||||||
|
list_shift.push(next_tr);
|
||||||
|
cur_tr = next_tr;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
else{
|
||||||
|
last_tr = cur_tr.next();
|
||||||
|
}
|
||||||
|
if(last_tr.length != 0 && last_tr.attr('level')==level){
|
||||||
|
var last_tr_id = (last_tr.attr('id')).split('-')[1];
|
||||||
|
img = last_tr.find("img[id='parentimg-"+last_tr_id+"']").attr('src');
|
||||||
|
if(img){
|
||||||
|
$("img[id='parentimg-"+last_tr_id+"']").attr('src', '/web/static/src/img/expand.gif');
|
||||||
|
while(1){
|
||||||
|
var next_tr = last_tr.next();
|
||||||
|
if (next_tr.attr('level') <= level || next_tr.length==0){break;}
|
||||||
|
next_tr.hide();
|
||||||
|
last_tr = next_tr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list_shift.reverse();
|
||||||
|
_.each(list_shift,function(rec){
|
||||||
|
$(last_tr).after(rec);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -218,10 +392,10 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
if (nxt_tr.attr('level') > level){
|
if (nxt_tr.attr('level') > level){
|
||||||
cur_tr = nxt_tr;
|
cur_tr = nxt_tr;
|
||||||
nxt_tr.hide();
|
nxt_tr.hide();
|
||||||
}else break;
|
}else return nxt_tr;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
on_collapse: function(self,parent_child_id){
|
on_collapse: function(self,parent_child_id,id,main_object){
|
||||||
var id = self.id.split('-')[1];
|
var id = self.id.split('-')[1];
|
||||||
var datas = _.detect(parent_child_id,function(res){
|
var datas = _.detect(parent_child_id,function(res){
|
||||||
return res.key == id;
|
return res.key == id;
|
||||||
|
@ -231,6 +405,39 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
||||||
tr.find("img[id='parentimg-"+rec+"']").attr('src','/web/static/src/img/expand.gif');
|
tr.find("img[id='parentimg-"+rec+"']").attr('src','/web/static/src/img/expand.gif');
|
||||||
tr.show();
|
tr.show();
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
on_edit_node:function(self,property,fld_name){
|
||||||
|
var self = this;
|
||||||
|
var result;
|
||||||
|
this.dialog = new openerp.web.Dialog(this,{
|
||||||
|
modal: true,
|
||||||
|
title: 'Properties',
|
||||||
|
width: 650,
|
||||||
|
height: 150,
|
||||||
|
buttons: {
|
||||||
|
"Update": function(){
|
||||||
|
},
|
||||||
|
"Cancel": function(){
|
||||||
|
$(this).dialog('destroy');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.dialog.start().open();
|
||||||
|
dataset = new openerp.web.DataSetSearch(this,'ir.model', null, null);
|
||||||
|
dataset.read_slice([],{domain : [['model','=',self.model]]},function (result) {
|
||||||
|
db = new openerp.web.DataSetSearch(self,'ir.model.fields', null, null);
|
||||||
|
db.read_slice([],{domain : [['model_id','=',result[0].id],['name','=',fld_name]]},function (res) {
|
||||||
|
var data = [];
|
||||||
|
_.each(property,function(record){
|
||||||
|
var dict = {'key':record,'value':res[0][record]};
|
||||||
|
data.push(dict);
|
||||||
|
});
|
||||||
|
console.log("check data+++",data);
|
||||||
|
/*self.dialog.$element.html(QWeb.render('Edit_Node_View',{
|
||||||
|
'res': res
|
||||||
|
}));*/
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
|
@ -1290,7 +1290,7 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td width="16px" t-att-style="'background-position: ' + 20*rec.level + 'px; padding-left: ' + 20*rec.level + 'px'">
|
<td width="16px" t-att-style="'background-position: ' + 20*rec.level + 'px; padding-left: ' + 20*rec.level + 'px'">
|
||||||
<img t-if="rec.child_id.length" t-att-id="'parentimg-' + rec.id"
|
<img t-if="rec.child_id.length" t-att-id="'parentimg-' + rec.id"
|
||||||
src="/web/static/src/img/collapse.gif" width="16" height="16" border="0"/>
|
src="/web/static/src/img/collapse.gif" width="16" height="16" border="0"/>
|
||||||
</td>
|
</td>
|
||||||
<td style="cursor: pointer;">
|
<td style="cursor: pointer;">
|
||||||
|
@ -1302,20 +1302,20 @@
|
||||||
<td align="left" class="view_editor" width="15%">
|
<td align="left" class="view_editor" width="15%">
|
||||||
<table cellspacing="0" cellpadding ="0" width="100%">
|
<table cellspacing="0" cellpadding ="0" width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img id="side-add" src="/web/static/src/img/icons/gtk-add.png" style="cursor: pointer;"/>
|
<img id="side-add" src="/web/static/src/img/icons/gtk-add.png" style="cursor: pointer;"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img id="side-remove" src="/web/static/src/img/icons/gtk-remove.png" style="cursor: pointer;"/>
|
<img id="side-remove" src="/web/static/src/img/icons/gtk-remove.png" style="cursor: pointer;"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img id="side-edit" src="/web/static/src/img/icons/gtk-edit.png" style="cursor: pointer;"/>
|
<img id="side-edit" src="/web/static/src/img/icons/gtk-edit.png" style="cursor: pointer;"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img id="side-up" src="/web/static/src/img/icons/gtk-go-up.png" style="cursor: pointer;"/>
|
<img id="side-up" src="/web/static/src/img/icons/gtk-go-up.png" style="cursor: pointer;"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img id="side-down" src="/web/static/src/img/icons/gtk-go-down.png" style="cursor: pointer;"/>
|
<img id="side-down" src="/web/static/src/img/icons/gtk-go-down.png" style="cursor: pointer;"/>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1325,7 +1325,13 @@
|
||||||
<t t-call="view_editor.row"/>
|
<t t-call="view_editor.row"/>
|
||||||
</t>
|
</t>
|
||||||
</tr>
|
</tr>
|
||||||
|
<t t-name="Edit_Node_View">
|
||||||
|
<table>
|
||||||
|
<tr t-foreach="res" t-as="rec">
|
||||||
|
<td><t t-esc="rec.ttype"/></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</t>
|
||||||
<t t-name="ExportView">
|
<t t-name="ExportView">
|
||||||
<a id="exportview" href="javascript: void(0)" style="text-decoration: none;color: #3D3D3D;">Export</a>
|
<a id="exportview" href="javascript: void(0)" style="text-decoration: none;color: #3D3D3D;">Export</a>
|
||||||
</t>
|
</t>
|
||||||
|
|
Loading…
Reference in New Issue