2016-04-14 6 views

答えて

0

お試しください view.xmlファイルのフォームビューのフィールドでウィジェットを設定する必要があります。

view.xml

<form string="Graph"> 
        <field name="name" widget="test"/>  
</form> 

我々は

D3_chart.js、次のようにクラスopenerp.web.form.FieldChar.extendを拡張する必要がある、その後1 JSファイルを作成する必要があります

openerp.transform_organization_chart = function(openerp) { 


    openerp.web.form.widgets.add('test','openerp.web.form.test'); 

    openerp.web.form.test = openerp.web.form.FieldChar.extend(
      { 
       template: 'test-button', 

       init: function() { 
        this._super.apply(this, arguments); 
        this._start = null; 
       }, 

       start: function() { 
        console.log('START'); 
        this.Myfunction(); 
       }, 



       Myfunction: function() 

       { 


       } 



      }); 
} 

私たちのチャートのtemplate.xmlファイルを作成します。ここでは、htmlテンプレートテンプレートIDと拡張フィールドの文字の名前は同じでなければなりません。コードは、トラッキングコードを有すること

template.xml

<template id="test-button"> 
<script type="text/javascript" src="/transform_organization_chart/static/src/js/d3.js"></script> 
      <div t-name="test-button"> 
       <div id="orgChartContainer"> 
        <div id="orgChart"></div> 
        </div> 
       <div id="consoleOutput"></div> 
      </div> 
</template> 
+2

は( '_gaq')は、潜在的に有害です。それを修正する必要があります。 –

関連する問題