odoo的qweb图表功能

1.TB_quotation_templates.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>


        <template id="indexdafenlei"   >

            <head>

                <title>首页</title>

                <link href="/estimation/static/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
                <script type="text/javascript" src="/estimation/static/jquery.min.js"/>

                <script type="text/javascript" src="/estimation/static/bootstrap/js/bootstrap.min.js"/>

                <script type="text/javascript" src="/estimation/static/js/WdatePicker.js"/>
                <script type="text/javascript"  language="javascript">
        var editid;
        var interval = 1000; 
        function ShowCountDown002II() 
        {

        }
        function btnoncklic() 
        {
         d1=document.getElementById("datetimepicker1").value;
         if(d1=='')
         {
         d1='0'
         }
         d2=document.getElementById("datetimepicker2").value;
         if(d2=='')
         {
         d2='0'
         }
         h1=document.getElementById("ftitle").value;
         if(h1=='')
         {
         h1='0'
         }         

         url="http://123.56.237.215:8069/academydafen/1/"+d1+"/"+d2+"/"+h1+"/"
         ///alert(url);
         window.location.href=url;

        }

                </script>
                <script type="text/javascript" src="/estimation/static/chat/jquery-1.8.3.min.js"/>
                <style type="text/css">
                 ${demo.css}
                </style>

                <script type="text/javascript"   src="/estimation/static/chat/funtion.js"/>
                <script type="text/javascript"   src="/estimation/static/js/funtion2.js"/>
            </head>
            <body width="801px;"  height="395px;">


                <div id="home">
                    <form id="tab">
                        <label style="width:100px;"/>
                        <label>人员</label>
                        <input type="text" value=""  id="ftitle" />

                        <label>开始时间</label>
                        <input type="text" class="Wdate"  onClick="WdatePicker()" id="datetimepicker1"/>


                        <label>结束时间</label>
                        <input type="text" class="Wdate"  onClick="WdatePicker()" id="datetimepicker2"/>
                        <label style="width:60px;"/>

                        <button type="button" class="btn btn-primary"   onClick="btnoncklic();">查询</button>
                    </form>
                </div>


                <button type="button" class="btn btn-primary">分类统计</button>
                <script src="/estimation/static/chat/highcharts.js"/>
                <script src="/estimation/static/chat/exporting.js"/>
                <div id="container"  style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"  />    
                <span οnclick="JavaScript:ChangeDiv('0','JKDiv_',3)"    style="cursor:hand;color:#FF0000;font:12px/1.5 arial;"> 
                    <button type="button" class="btn btn-primary">德</button>

                </span> 
                <span οnclick="JavaScript:ChangeDiv('1','JKDiv_',3)"   style="cursor:hand;color:#FF0000;font:12px/1.5 arial;"> 

                    <button type="button" class="btn btn-primary">能</button>
                </span> 
                <span οnclick="JavaScript:ChangeDiv('2','JKDiv_',3)"   style="cursor:hand;color:#FF0000;font:12px/1.5 arial;"> 

                    <button type="button" class="btn btn-primary">勤 </button>

                </span> 
                <span οnclick="JavaScript:ChangeDiv('3','JKDiv_',3)" style="cursor:hand;color:#FF0000;font:12px/1.5 arial;">  
                    <button type="button" class="btn btn-primary">绩 </button>   
                </span> 
                <span οnclick="JavaScript:ChangeDiv('4','JKDiv_',3)"   style="cursor:hand;color:#FF0000;font:12px/1.5 arial;">


                    <button type="button" class="btn btn-primary">申请   </button>   
                </span> 
                <div id="JKDiv_0" >

                    <table class="table table-striped">
                        <caption/>
                        <thead>
                            <tr>
                                <th>分类</th>
                                <th>工号</th>
                                <th>姓名</th>


                                <th>得分</th>

                                <th>排名</th>

                            </tr>
                        </thead>
                        <tbody>

                            <t t-foreach="teachers" t-as="teacher">

                                <tr >

                                    <td>
                                        <div  t-esc="teacher.id"/>
                                    </td>
                                    <td>
                                        <div  t-field="teacher.job_id"/>
                                    </td>
                                    <td>
                                        <div  />
                                    </td>

                                    <td>
                                        <div />
                                    </td>

                                    <td>
                                        <div  />

                                    </td>


                                </tr>
                            </t>


                        </tbody>
                    </table>
                </div> 
                <div id="JKDiv_1" style="display:none;">


                    <table class="table table-striped " >
                        <caption/>
                        <thead>
                            <tr>
                                <th>分类</th>
                                <th>工号</th>
                                <th>姓名</th>


                                <th>得分</th>

                                <th>排名</th>

                            </tr>
                        </thead>
                        <tbody>

                        <t t-foreach="teachers" t-as="teacher">

                                <tr >

                                    <td>
                                        <div  t-esc="teacher.id"/>
                                    </td>
                                    <td>
                                        <div  t-field="teacher.job_id"/>
                                    </td>
                                    <td>
                                        <div  />
                                    </td>

                                    <td>
                                        <div />
                                    </td>

                                    <td>
                                        <div  />

                                    </td>


                                </tr>
                            </t>


                        </tbody>
                    </table>
                </div> 
                <div id="JKDiv_2" style="display:none;">
                    <table class="table table-striped">
                        <caption/>
                        <thead>
                            <tr>
                                <th>分类</th>
                                <th>工号</th>
                                <th>姓名</th>


                                <th>得分</th>

                                <th>排名</th>

                            </tr>
                        </thead>
                        <tbody>

                            <t t-foreach="teachers" t-as="teacher">

                                <tr >

                                    <td>
                                        <div  t-esc="teacher.id"/>
                                    </td>
                                    <td>
                                        <div  t-field="teacher.job_id"/>
                                    </td>
                                    <td>
                                        <div  />
                                    </td>

                                    <td>
                                        <div />
                                    </td>

                                    <td>
                                        <div  />

                                    </td>


                                </tr>
                            </t>

                        </tbody>
                    </table>

                </div> 

                <div id="JKDiv_3" style="display:none;">

                    <table class="table table-striped">
                        <caption/>
                        <thead>
                            <tr>
                                <th>分类</th>
                                <th>工号</th>
                                <th>姓名</th>


                                <th>得分</th>

                                <th>排名</th>

                            </tr>
                        </thead>
                        <tbody>

                            <t t-foreach="teachers" t-as="teacher">

                                <tr >

                                    <td>
                                        <div  t-esc="teacher.id"/>
                                    </td>
                                    <td>
                                        <div  t-field="teacher.job_id"/>
                                    </td>
                                    <td>
                                        <div  />
                                    </td>

                                    <td>
                                        <div />
                                    </td>

                                    <td>
                                        <div  />

                                    </td>


                                </tr>
                            </t>

                        </tbody>
                    </table>

                </div> 
                <div id="JKDiv_4" style="display:none;">

                    <table class="table table-striped">
                        <caption/>
                        <thead>
                            <tr>
                                <th>分类</th>
                                <th>工号</th>
                                <th>姓名</th>


                                <th>得分</th>

                                <th>排名</th>

                            </tr>
                        </thead>
                        <tbody>

                            <t t-foreach="teachers" t-as="teacher">

                                <tr >

                                    <td>
                                        <div  t-esc="teacher.id"/>
                                    </td>
                                    <td>
                                        <div  t-field="teacher.job_id"/>
                                    </td>
                                    <td>
                                        <div  />
                                    </td>

                                    <td>
                                        <div />
                                    </td>

                                    <td>
                                        <div  />

                                    </td>


                                </tr>
                            </t>


                        </tbody>
                    </table>


                </div> 

                <script type="text/javascript"  language="javascript">

                </script>
            </body>
        </template>        


    </data>
</openerp>
2.estimation_bumentongji_view.xml

        <record id="view_bumentongji_type_tbadmin" model="ir.ui.view">
            <field name="name">部门统计</field>
            <field name="model">estimation.bumentongji</field>
            <field name="arch" type="xml">
                <kanban  create="1">

                    <templates id="index"  >
                        <t t-name="kanban-box">
                            <iframe src="/academydafen/1/" width="988" height="640"  frameborder="0" scrolling="auto" />
                        </t>

                    </templates>
                </kanban>
            </field>
        </record>

 

3.main.py

# -*- coding: utf-8 -*-

import ast
import base64
import csv
import functools
import glob
import itertools
import jinja2
import logging
import operator
import datetime
import hashlib
import os
import re
import simplejson
import sys
import time
import urllib2
import zlib
from xml.etree import ElementTree
from cStringIO import StringIO

import babel.messages.pofile
import werkzeug.utils
import werkzeug.wrappers
try:
    import xlwt
except ImportError:
    xlwt = None
from openerp.osv import fields, osv
from openerp.tools.translate import _

import time
import datetime
import openerp
import openerp.modules.registry
from openerp.addons.base.ir.ir_qweb import AssetsBundle, QWebTemplateNotFound
from openerp.modules import get_module_resource
from openerp.tools import topological_sort
from openerp.tools.translate import _
from openerp import http

from openerp.http import request, serialize_exception as _serialize_exception

_logger = logging.getLogger(__name__)


import werkzeug

from openerp import SUPERUSER_ID
from openerp import http
from openerp.http import request
from openerp.tools.translate import _
from openerp.addons.website.models.website import slug
import time,datetime
class Academy(http.Controller):


    @http.route('/academydafen/<int:id>/', auth='public', website=True)        
    def teacherdafenlei(self, id):

        cr, uid, context, registry = request.cr, request.uid, request.context, request.registry    
        Teachers = http.request.env['hr.employee']
        #scontext={'search_default_FAdddatejs':'shiweishuai'} 
        request.session.FAdddateks=None
        request.session.FAdddatejs=None
        return "<!DOCTYPE html>"+http.request.render('estimation.indexdafenlei', {
        'teachers': Teachers.search([]),    
        },False)        
        

# vim:expandtab:tabstop=4:softtabstop=4:shiftwidth=4:
 

转载于:https://my.oschina.net/u/3740195/blog/1591084

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值