_napster

Untitled

Dec 1st, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. please find the code that i edited as marked as mycode ..Is this there is any other way to do this
  2.  
  3.  
  4.  
  5. openerp.gantt_view_custom = function(instance){
  6.  
  7. instance.gantt_view_custom = {};
  8.  
  9. var module = instance.web_gantt;
  10.  
  11. var _super_ = module.GanttTask.prototype.create;
  12.  
  13. gantt_view_custom.GanttTask.prototype.create = function(){
  14.      console.log('Hello!');
  15.      _super_.call(this);
  16. };
  17. }
  18.  
  19.  
  20.  
  21.        console.log("this     yyyyyyyy      creae")
  22.  
  23.     var containerTasks = this.Chart.oData.firstChild;
  24.     var containerNames = null;
  25.     if (this.Chart._showTreePanel) containerNames = this.Chart.panelNames.firstChild;
  26.     var predecessorTask = this.TaskInfo.PredecessorTask;
  27.     var parentTask = this.TaskInfo.ParentTask;
  28.     var isCParentTask = (this.TaskInfo.ChildTasks.length > 0);
  29.     var self = this;
  30.  
  31.     this.cTaskItem = [];
  32.     this.cTaskNameItem = [];
  33.  
  34.     //creation arrTasks
  35.     if (!parentTask)
  36.     {
  37.         if (this.TaskInfo.previousParentTask) {
  38.             this.previousParentTask = this.Project.getTaskById(this.TaskInfo.previousParentTask.Id);
  39.             var lastChildTask = this.Chart.getLastChildTask(this.previousParentTask);
  40.  
  41.  
  42.  
  43. // ########################   My code
  44.  
  45.         // for moving the workorder bar to the manufactoring order
  46.  
  47.             this.posY = this.Project.posY;
  48.  
  49. // #########################################
  50.  
  51. //            this.posY = parseInt(lastChildTask.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;
  52.  
  53.             this.previousParentTask.nextParentTask = this;
  54.  
  55.         } else {
  56.  
  57.             // ########################   My code
  58.  
  59.             // for moving the workorder bar to the manufactoring order
  60.  
  61.             this.posY = this.Project.posY;
  62.  
  63. // #########################################
  64.  
  65.  
  66. //            this.posY = parseInt(this.Project.projectItem[0].style.top) + this.Chart.heightTaskItem + 11;
  67.         }
  68.     }
  69.  
  70.     if (parentTask) {
  71.         var task = this.Project.getTaskById(this.TaskInfo.ParentTask.Id);
  72.         this.parentTask = task;
  73.  
  74.         if (this.TaskInfo.previousChildTask) {
  75.             this.previousChildTask = this.Project.getTaskById(this.TaskInfo.previousChildTask.Id);
  76.             var lastChildTask = this.Chart.getLastChildTask(this.previousChildTask);
  77.             this.posY = parseInt(lastChildTask.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;
  78.             this.previousChildTask.nextChildTask = this;
  79.  
  80.         } else {
  81.             this.posY = parseInt(task.cTaskItem[0].style.top) + this.Chart.heightTaskItem + 11;
  82.         }
  83.         task.childTask.push(this);
  84.     }
  85.  
  86.     if (predecessorTask) {
  87.         var task = this.Project.getTaskById(predecessorTask.Id);
  88.         this.predTask = task;
  89.         task.childPredTask.push(this);
  90.     }
  91.  
  92.     //creation task item
  93.     this.cTaskItem.push(this.createTaskItem());
  94.     containerTasks.appendChild(this.cTaskItem[0]);
  95.  
  96.     if (this.Chart.panelNames) {
  97.         this.cTaskNameItem.push(this.createTaskNameItem(isCParentTask));
  98.         this.Chart.panelNames.firstChild.appendChild(this.cTaskNameItem[0]);
  99.     }
  100.  
  101.     if (this.Chart.isShowDescTask) {
  102.         containerTasks.appendChild(this.createTaskDescItem());
  103.     }
  104.  
  105.     //Create Connecting Lines
  106.     var arrConnectingLines = [];
  107.     if (predecessorTask) arrConnectingLines = this.createConnectingLinesDS();
  108.     this.cTaskItem.push(arrConnectingLines);
  109.  
  110.     if (this.Chart.panelNames)
  111.     {
  112.         //Create Connecting Lines
  113.         var arrConnectingLinesNames = [];
  114.         if (parentTask)
  115.         {
  116.             this.cTaskNameItem[0].style.left = parseInt(this.parentTask.cTaskNameItem[0].style.left) + 15 + "px";
  117.             arrConnectingLinesNames = this.createConnectingLinesPN();
  118.         }
  119.         this.checkWidthTaskNameItem();
  120.  
  121.         var treeImg = null;
  122.         if (isCParentTask) treeImg = this.createTreeImg();
  123.  
  124.         this.cTaskNameItem.push(arrConnectingLinesNames);
  125.         this.cTaskNameItem.push(treeImg);
  126.     }
  127.     this.addDayInPanelTime();
  128. //    console.log("thissssssssssdddddddddddddssssssss",this)
  129.     console.log("thissssssssssdddddddddddddssssssss",this.Project.posY)
  130. //    console.log("thissssssssssdddddddddddddssssssss",this.posY)
  131. //    this.posY = this.Project.posY
  132. //    console.log("thissssssssssdddddddddddddssssssss",this.posY)
  133. //
  134.    
  135.  
  136. // ########################   My code
  137.  
  138.     if (this.Chart.Project){
  139.         var project_obj = this.Chart.Project;
  140.     }
  141.     for (var key in project_obj) {
  142.           if (project_obj.hasOwnProperty(key)) {
  143.             console.log(key + " -> " , project_obj[key]['Id']);
  144.             var id_project = project_obj[key]['Id']
  145.             $("#"+id_project.toString()).css("display", "None");
  146.           }
  147.         }
  148.         $(".taskNameItem").css("display", "None"); //hiding the workorder
  149. // my code
  150.     return this;
  151.  
  152.  
  153. };
Add Comment
Please, Sign In to add comment