add ui enhance
2
app_ui_enhance/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import models
|
||||||
50
app_ui_enhance/__openerp__.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Created on 2017-11-05
|
||||||
|
# author: 广州尚鹏,http://www.sunpop.cn
|
||||||
|
# email: 300883@qq.com
|
||||||
|
# resource of Sunpop
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
# Odoo在线中文用户手册(长期更新)
|
||||||
|
# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
|
||||||
|
|
||||||
|
# Odoo10离线中文用户手册下载
|
||||||
|
# http://www.sunpop.cn/odoo10_user_manual_document_offline/
|
||||||
|
# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备)
|
||||||
|
# http://www.sunpop.cn/odoo10_developer_document_offline/
|
||||||
|
# description:
|
||||||
|
{
|
||||||
|
'name': 'App Web UI Enhance',
|
||||||
|
'version': '10.0.1.0',
|
||||||
|
'author': 'Sunpop.cn',
|
||||||
|
'category': 'web',
|
||||||
|
'website': 'http://www.sunpop.cn',
|
||||||
|
'license': 'AGPL-3',
|
||||||
|
'sequence': 2,
|
||||||
|
'summary': 'UI Enhance for Odoo',
|
||||||
|
'description': """
|
||||||
|
|
||||||
|
Search by date or number range in List view and Pivot view
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
""",
|
||||||
|
'depends': ['web','app_odoo_customize'],
|
||||||
|
'data': [
|
||||||
|
'views/app_ui_config_settings_view.xml',
|
||||||
|
'views/template_view.xml',
|
||||||
|
# data
|
||||||
|
'data/ir_config_parameter.xml',
|
||||||
|
],
|
||||||
|
'qweb': [
|
||||||
|
'static/src/xml/*.xml',
|
||||||
|
],
|
||||||
|
"price": 68.00,
|
||||||
|
"currency": "EUR",
|
||||||
|
|
||||||
|
'images': ['static/description/list_pivot.png'],
|
||||||
|
|
||||||
|
'installable': True,
|
||||||
|
'auto_install': False,
|
||||||
|
'application': True,
|
||||||
|
}
|
||||||
13
app_ui_enhance/data/ir_config_parameter.xml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<openerp>
|
||||||
|
<data noupdate="0">
|
||||||
|
<record id="app_ui_show_search_date" model="ir.config_parameter">
|
||||||
|
<field name="key">app_ui_show_search_date</field>
|
||||||
|
<field name="value">True</field>
|
||||||
|
</record>
|
||||||
|
<record id="app_ui_show_search_number" model="ir.config_parameter">
|
||||||
|
<field name="key">app_ui_show_search_number</field>
|
||||||
|
<field name="value">True</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
145
app_ui_enhance/i18n/zh_CN.po
Normal file
@@ -0,0 +1,145 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * app_ui_enhance
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 10.0+e-20171107\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"POT-Creation-Date: 2017-11-16 09:24+0000\n"
|
||||||
|
"PO-Revision-Date: 2017-11-16 09:24+0000\n"
|
||||||
|
"Last-Translator: <300883@qq.com>"
|
||||||
|
"Language-Team: Sunpop.cn"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/app_ui_enhance/static/src/xml/pivot_view.xml:70
|
||||||
|
#: code:addons/app_ui_enhance/static/src/xml/pivot_view.xml:91
|
||||||
|
#, python-format
|
||||||
|
msgid "All"
|
||||||
|
msgstr "全部"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model,name:app_ui_enhance.model_app_ui_config_settings
|
||||||
|
msgid "App Web UI enhance settings"
|
||||||
|
msgstr "界面优化设置"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.ui.view,arch_db:app_ui_enhance.view_app_ui_config_settings
|
||||||
|
msgid "Apply"
|
||||||
|
msgstr "应用"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.ui.view,arch_db:app_ui_enhance.view_app_ui_config_settings
|
||||||
|
msgid "Cancel"
|
||||||
|
msgstr "取消"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_create_uid
|
||||||
|
msgid "Created by"
|
||||||
|
msgstr "创建人"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_create_date
|
||||||
|
msgid "Created on"
|
||||||
|
msgstr "创建时间"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_display_name
|
||||||
|
msgid "Display Name"
|
||||||
|
msgstr "显示名称"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/app_ui_enhance/static/src/xml/pivot_view.xml:22
|
||||||
|
#, python-format
|
||||||
|
msgid "End date"
|
||||||
|
msgstr "结束日期"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/app_ui_enhance/static/src/xml/pivot_view.xml:45
|
||||||
|
#, python-format
|
||||||
|
msgid "From"
|
||||||
|
msgstr "从"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_id
|
||||||
|
msgid "ID"
|
||||||
|
msgstr "ID"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.ui.view,arch_db:app_ui_enhance.view_app_ui_config_settings
|
||||||
|
msgid "Item to Show"
|
||||||
|
msgstr "显示/隐藏菜单项"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings___last_update
|
||||||
|
msgid "Last Modified on"
|
||||||
|
msgstr "最后修改日"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_write_uid
|
||||||
|
msgid "Last Updated by"
|
||||||
|
msgstr "最后更新人"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_write_date
|
||||||
|
msgid "Last Updated on"
|
||||||
|
msgstr "最后更新时间"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.ui.view,arch_db:app_ui_enhance.view_app_ui_config_settings
|
||||||
|
msgid "Search Enhance"
|
||||||
|
msgstr "搜索增加"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,help:app_ui_enhance.field_app_ui_config_settings_app_ui_show_search_date
|
||||||
|
#: model:ir.model.fields,help:app_ui_enhance.field_app_ui_config_settings_app_ui_show_search_number
|
||||||
|
msgid "Set 'True' to show, Set 'False' to hide"
|
||||||
|
msgstr "设为 'True' 则显示,设为 'False' 则隐藏"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_app_ui_show_search_date
|
||||||
|
msgid "Show date range search in tree/pivot view"
|
||||||
|
msgstr "显示日期搜索,在tree/pivot视图生效"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_app_ui_show_search_number
|
||||||
|
msgid "Show number range search tree/pivot view"
|
||||||
|
msgstr "显示数值搜索,在tree/pivot视图生效"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/app_ui_enhance/static/src/xml/pivot_view.xml:18
|
||||||
|
#, python-format
|
||||||
|
msgid "Start date"
|
||||||
|
msgstr "开始日期"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#. openerp-web
|
||||||
|
#: code:addons/app_ui_enhance/static/src/xml/pivot_view.xml:49
|
||||||
|
#, python-format
|
||||||
|
msgid "To"
|
||||||
|
msgstr "至"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.actions.act_window,name:app_ui_enhance.action_app_ui_config
|
||||||
|
#: model:ir.ui.menu,name:app_ui_enhance.menu_app_ui_config
|
||||||
|
msgid "UI Enhance"
|
||||||
|
msgstr "界面增强"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.ui.view,arch_db:app_ui_enhance.view_app_ui_config_settings
|
||||||
|
msgid "odoo UI Enhance"
|
||||||
|
msgstr "odoo 界面增强"
|
||||||
|
|
||||||
|
#. module: app_ui_enhance
|
||||||
|
#: model:ir.ui.view,arch_db:app_ui_enhance.view_app_ui_config_settings
|
||||||
|
msgid "odooApp UI Settings"
|
||||||
|
msgstr "界面增强设置"
|
||||||
|
|
||||||
2
app_ui_enhance/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import app_ui_config_settings
|
||||||
50
app_ui_enhance/models/app_ui_config_settings.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# Created on 2017-11-16
|
||||||
|
# author: 广州尚鹏,http://www.sunpop.cn
|
||||||
|
# email: 300883@qq.com
|
||||||
|
# resource of Sunpop
|
||||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
|
# Odoo在线中文用户手册(长期更新)
|
||||||
|
# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
|
||||||
|
|
||||||
|
# Odoo10离线中文用户手册下载
|
||||||
|
# http://www.sunpop.cn/odoo10_user_manual_document_offline/
|
||||||
|
# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备)
|
||||||
|
# http://www.sunpop.cn/odoo10_developer_document_offline/
|
||||||
|
# description:
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from openerp import api, fields, models, _
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class AppUiConfigSettings(models.TransientModel):
|
||||||
|
_inherit = 'res.config.settings'
|
||||||
|
_name = 'app.ui.config.settings'
|
||||||
|
|
||||||
|
_description = u"App Web UI enhance settings"
|
||||||
|
app_ui_show_search_date = fields.Boolean('Show date range search in tree/pivot view', help=u"Set 'True' to show, Set 'False' to hide")
|
||||||
|
app_ui_show_search_number = fields.Boolean('Show number range search tree/pivot view', help=u"Set 'True' to show, Set 'False' to hide")
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def get_default_all(self, fields):
|
||||||
|
ir_config = self.env['ir.config_parameter']
|
||||||
|
app_ui_show_search_date = True if ir_config.get_param('app_ui_show_search_date') == "True" else False
|
||||||
|
app_ui_show_search_number = True if ir_config.get_param('app_ui_show_search_number') == "True" else False
|
||||||
|
|
||||||
|
return dict(
|
||||||
|
app_ui_show_search_date=app_ui_show_search_date,
|
||||||
|
app_ui_show_search_number=app_ui_show_search_number
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def set_default_all(self):
|
||||||
|
self.ensure_one()
|
||||||
|
ir_config = self.env['ir.config_parameter']
|
||||||
|
ir_config.set_param("app_ui_show_search_date", self.app_ui_show_search_date or "False")
|
||||||
|
ir_config.set_param("app_ui_show_search_number", self.app_ui_show_search_number or "False")
|
||||||
|
return True
|
||||||
BIN
app_ui_enhance/static/description/date_range.jpg
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
app_ui_enhance/static/description/date_range.png
Normal file
|
After Width: | Height: | Size: 325 KiB |
BIN
app_ui_enhance/static/description/icon.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
91
app_ui_enhance/static/description/index.html
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<section class="oe_container">
|
||||||
|
<div class="oe_row oe_spaced" style="max-width: 800px;">
|
||||||
|
<div class="oe_span12">
|
||||||
|
<h2 class="oe_slogan">App Search By Date or Number Range</h2>
|
||||||
|
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
||||||
|
<p>This moduld allows user to Search by date or number range in List view and Pivot view. </p>
|
||||||
|
<br>
|
||||||
|
<ul>
|
||||||
|
<li>1.List all the date/datetime field to select range</li>
|
||||||
|
<li>2.List all the integer/float/Monetary field to select range</li>
|
||||||
|
<li>3.Auto get user timezone, global Timezone supported.</li>
|
||||||
|
<li>4.Easy admin to enable/disable the search.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="oe_container">
|
||||||
|
<div class="oe_row oe_spaced">
|
||||||
|
<h2 class="oe_slogan" style="color:#875A7B;">Date range</h2>
|
||||||
|
<div class="oe_demo oe_picture oe_screenshot">
|
||||||
|
<img src="date_range.jpg">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="oe_container oe_dark">
|
||||||
|
<div class="oe_row oe_spaced">
|
||||||
|
<h2 class="oe_slogan" style="color:#875A7B;">Value range</h2>
|
||||||
|
<div class="oe_demo oe_picture oe_screenshot">
|
||||||
|
<img src="value_range.jpg">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="oe_container oe_dark">
|
||||||
|
<div class="oe_row oe_spaced">
|
||||||
|
<h2 class="oe_slogan" style="color:#875A7B;">Pivot View</h2>
|
||||||
|
<div class="oe_demo oe_picture oe_screenshot">
|
||||||
|
<img src="list_pivot.jpg">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="oe_container oe_dark">
|
||||||
|
<div class="oe_row oe_spaced">
|
||||||
|
<h2 class="oe_slogan" style="color:#875A7B;">How to setup</h2>
|
||||||
|
<p>Go to Menu: Settings->Technical->Parameters->System Parameters</p>
|
||||||
|
<p>You can find "app_ui_show_search_date" and "app_ui_show_search_number"</p>
|
||||||
|
<p>Go to Menu: Settings->Technical->Parameters->System Parameters.</p>
|
||||||
|
<p>Set the Value to "False" if you do not want to show the search. And set "True" to show.</p>
|
||||||
|
<div class="oe_demo oe_picture oe_screenshot">
|
||||||
|
<img src="setup.jpg">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="oe_container oe_dark">
|
||||||
|
<div class="oe_row oe_spaced text-center">
|
||||||
|
<div class="oe_span12">
|
||||||
|
<h2 class="oe_slogan">Technical Help & Support</h2>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-12 pad0">
|
||||||
|
<div class="oe_mt16">
|
||||||
|
<p><h4>
|
||||||
|
For any type of technical help & support requests, Feel free to contact us</h4></p>
|
||||||
|
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||||
|
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com"><span
|
||||||
|
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||||
|
<i class="fa fa-envelope"></i> guohuadeng@hotmail.com</a>
|
||||||
|
<p><h4>
|
||||||
|
Via QQ: 300883</h4></p>
|
||||||
|
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||||
|
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:300883@qq.com"><span
|
||||||
|
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||||
|
<i class="fa fa-envelope"></i> 300883@qq.com</a>
|
||||||
|
</div>
|
||||||
|
<div class="oe_mt16">
|
||||||
|
<p><h4>
|
||||||
|
Visit our website for more support.</h4></p>
|
||||||
|
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
|
||||||
|
class="btn btn-warning btn-lg" rel="nofollow" href="http://www.sunpop.cn" target="_blank"><span
|
||||||
|
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
|
||||||
|
<i class="fa fa-web"></i>http://www.sunpop.cn</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section class="oe_container oe_separator">
|
||||||
|
</section>
|
||||||
BIN
app_ui_enhance/static/description/list_pivot.jpg
Normal file
|
After Width: | Height: | Size: 48 KiB |
BIN
app_ui_enhance/static/description/list_pivot.png
Normal file
|
After Width: | Height: | Size: 205 KiB |
BIN
app_ui_enhance/static/description/setup.jpg
Normal file
|
After Width: | Height: | Size: 98 KiB |
BIN
app_ui_enhance/static/description/setup.png
Normal file
|
After Width: | Height: | Size: 174 KiB |
BIN
app_ui_enhance/static/description/value_range.jpg
Normal file
|
After Width: | Height: | Size: 51 KiB |
BIN
app_ui_enhance/static/description/value_range.png
Normal file
|
After Width: | Height: | Size: 246 KiB |
11
app_ui_enhance/static/src/css/app_ui_enhance.css
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
.tree_search_item {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.tree_search_item .selected a:before {
|
||||||
|
font-family: FontAwesome;
|
||||||
|
position: absolute;
|
||||||
|
left: 6px;
|
||||||
|
top: 3px;
|
||||||
|
content: "";
|
||||||
|
}
|
||||||
257
app_ui_enhance/static/src/js/pivot.js
Normal file
@@ -0,0 +1,257 @@
|
|||||||
|
odoo.define('app_ui_enhance.pivot', function (require) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var time = require('web.time');
|
||||||
|
var core = require('web.core');
|
||||||
|
var data = require('web.data');
|
||||||
|
var session = require('web.session');
|
||||||
|
var utils = require('web.utils');
|
||||||
|
var Model = require('web.Model');
|
||||||
|
var PivotView = require('web.PivotView');
|
||||||
|
var datepicker = require('web.datepicker');
|
||||||
|
|
||||||
|
var _t = core._t;
|
||||||
|
var _lt = core._lt;
|
||||||
|
var QWeb = core.qweb;
|
||||||
|
|
||||||
|
PivotView.include({
|
||||||
|
|
||||||
|
init: function() {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
this.ts_fields = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
tgl_on_button_click: function (event) {
|
||||||
|
var self = this;
|
||||||
|
var $target = $(event.target),
|
||||||
|
field, key, first_item;
|
||||||
|
|
||||||
|
field = $target.parent().data('field');
|
||||||
|
key = $target.parent().data('key');
|
||||||
|
|
||||||
|
if (field == -1) {
|
||||||
|
first_item = $target.parent().parent().children('.tgl_first_item.selected');
|
||||||
|
if (!first_item.length) {
|
||||||
|
$target.parent().parent().children('li').removeClass('selected')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
first_item = $target.parent().parent().children('.tgl_first_item').removeClass('selected');
|
||||||
|
}
|
||||||
|
|
||||||
|
$target.parent().toggleClass('selected');
|
||||||
|
this.tgl_search()
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
render_buttons: function($node) {
|
||||||
|
var self = this;
|
||||||
|
var ts_context = this.context.tree_search;
|
||||||
|
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
|
var l10n = _t.database.parameters;
|
||||||
|
var datepickers_options = {
|
||||||
|
pickTime: false,
|
||||||
|
startDate: moment({ y: 1900 }),
|
||||||
|
endDate: moment().add(200, "y"),
|
||||||
|
calendarWeeks: true,
|
||||||
|
icons : {
|
||||||
|
time: 'fa fa-clock-o',
|
||||||
|
date: 'fa fa-calendar',
|
||||||
|
up: 'fa fa-chevron-up',
|
||||||
|
down: 'fa fa-chevron-down'
|
||||||
|
},
|
||||||
|
language : moment.locale(),
|
||||||
|
format : time.strftime_to_moment_format(l10n.date_format),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dropdown list
|
||||||
|
|
||||||
|
$(QWeb.render("TGL.TreeSearch.Placeholder", {})).appendTo($node);
|
||||||
|
|
||||||
|
_.each(ts_context, function(item){
|
||||||
|
var field = _.find(self.fields, function(value, key, list){
|
||||||
|
return value.type == 'many2one' && value.relation && key === item.name;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (field) {
|
||||||
|
self.ts_fields.push(item.name);
|
||||||
|
|
||||||
|
new Model(field.relation).query(['id', 'display_name']).filter(new data.CompoundDomain(item.domain, field.domain)).context(new data.CompoundContext()).order_by('app_sequence').all().then(function (result) {
|
||||||
|
var $multi_search = $(QWeb.render("TGL.TreeSearch.Item", {'widget': {
|
||||||
|
'string': item.string,
|
||||||
|
'key': item.name,
|
||||||
|
'class_name': 'app_multi_item_' + item.name,
|
||||||
|
'fields': result,
|
||||||
|
}}))
|
||||||
|
|
||||||
|
$multi_search.find('li').click(self.tgl_on_button_click.bind(self));
|
||||||
|
|
||||||
|
setTimeout(function(){
|
||||||
|
$multi_search.appendTo($('.treesearch_placeholder'));
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// self.$buttons.find('.app-search').remove();
|
||||||
|
|
||||||
|
var date_fields = [];
|
||||||
|
// 增加参数控制app_ui_show_search_date
|
||||||
|
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_ui_show_search_date']], ['value']]).then(function (show) {
|
||||||
|
if (show.length >= 1 && (show[0]['value'] == "True")) {
|
||||||
|
_.each(self.fields, function (value, key, list) {
|
||||||
|
if (value.store && value.type === "datetime" || value.type === "date") {
|
||||||
|
date_fields.push([key, value.string]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (date_fields.length > 0) {
|
||||||
|
self.$search_button = $(QWeb.render('odooApp.buttons', {'date_fields': date_fields}))
|
||||||
|
self.$search_button.find('.app_start_date').datetimepicker(datepickers_options);
|
||||||
|
self.$search_button.find('.app_end_date').datetimepicker(datepickers_options);
|
||||||
|
self.$search_button.find('.app_start_date').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_button.find('.app_end_date').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_button.find('.app_select_field').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
setTimeout(function () {
|
||||||
|
self.$search_button.insertBefore($('.treesearch_placeholder'));
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var number_fields = [];
|
||||||
|
|
||||||
|
// 增加参数控制app_ui_show_search_number
|
||||||
|
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_ui_show_search_number']], ['value']]).then(function (show) {
|
||||||
|
if (show.length >= 1 && (show[0]['value'] == "True")) {
|
||||||
|
number_fields = [];
|
||||||
|
_.each(self.fields, function (value, key, list) {
|
||||||
|
if (value.string && value.string.length > 1 && value.store && (value.type === "integer" || value.type === "float" || value.type === "monetary")) {
|
||||||
|
number_fields.push([key, value.string]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (number_fields.length > 0) {
|
||||||
|
self.$search_range = $(QWeb.render('odooApp.SearchRange', {'number_fields': number_fields}))
|
||||||
|
self.$search_range.find('.app_select_range_field').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_range.find('.app_start_range').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_range.find('.app_end_range').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
setTimeout(function () {
|
||||||
|
self.$search_range.insertBefore($('.treesearch_placeholder'));
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
do_search: function(domain, context, group_by) {
|
||||||
|
var self = this;
|
||||||
|
this.last_domain = domain;
|
||||||
|
this.last_context = context;
|
||||||
|
this.last_group_by = group_by;
|
||||||
|
this.old_search = _.bind(this._super, this);
|
||||||
|
return self.tgl_search();
|
||||||
|
},
|
||||||
|
|
||||||
|
tgl_search: function() {
|
||||||
|
var self = this;
|
||||||
|
var domain = [], value, value_tmp;
|
||||||
|
|
||||||
|
_.each(self.ts_fields, function(field){
|
||||||
|
value = $('.app_item_' + field).val();
|
||||||
|
|
||||||
|
var select_fields = $('.app_multi_item_' + field).children('.selected'),
|
||||||
|
select_value = [];
|
||||||
|
if (select_fields.length > 0) {
|
||||||
|
_.each(select_fields, function(item){
|
||||||
|
value_tmp = $(item).data('field');
|
||||||
|
if (value_tmp > 0) {
|
||||||
|
select_value.push($(item).data('field'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (select_value.length) {
|
||||||
|
domain.push([field, 'in', select_value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 注意,date和datetime型的处理是不同的,已处理完
|
||||||
|
if (self.$search_button) {
|
||||||
|
var start_date = self.$search_button.find('.app_start_date').val(),
|
||||||
|
end_date = self.$search_button.find('.app_end_date').val(),
|
||||||
|
field = self.$search_button.find('.app_select_field').val(),
|
||||||
|
field_type = 'datetime';
|
||||||
|
var tz = session.user_context.tz,
|
||||||
|
start_utc,
|
||||||
|
end_utc;
|
||||||
|
|
||||||
|
_.each(self.columns, function (value, key, list) {
|
||||||
|
if (value.name == field) {
|
||||||
|
field_type = value.type;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
moment.locale(tz);
|
||||||
|
var l10n = _t.database.parameters;
|
||||||
|
if (start_date) {
|
||||||
|
if (field_type == 'date') {
|
||||||
|
//日期类型,无须utc处理
|
||||||
|
start_date = moment(moment(start_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD');
|
||||||
|
domain.push([field, '>=', start_date]);
|
||||||
|
} else {
|
||||||
|
//日期时间,处理utc
|
||||||
|
start_date = moment(moment(start_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD 00:00:00');
|
||||||
|
start_utc = moment(start_date)
|
||||||
|
domain.push([field, '>=', start_utc]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (end_date) {
|
||||||
|
if (field_type == 'date') {
|
||||||
|
end_date = moment(moment(end_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD');
|
||||||
|
domain.push([field, '<=', end_date]);
|
||||||
|
} else {
|
||||||
|
end_date = moment(moment(end_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD 00:00:00');
|
||||||
|
end_utc = moment(end_date)
|
||||||
|
domain.push([field, '<=', end_utc]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.$search_range) {
|
||||||
|
var start_range = self.$search_range.find('.app_start_range').val(),
|
||||||
|
end_range = self.$search_range.find('.app_end_range').val(),
|
||||||
|
range_field = self.$search_range.find('.app_select_range_field').val();
|
||||||
|
|
||||||
|
if (start_range) {
|
||||||
|
domain.push([range_field, '>=', parseInt(start_range)]);
|
||||||
|
}
|
||||||
|
if (end_range) {
|
||||||
|
domain.push([range_field, '<=', parseInt(end_range)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// console.log(domain);
|
||||||
|
var compound_domain = new data.CompoundDomain(self.last_domain, domain);
|
||||||
|
self.dataset.domain = compound_domain.eval();
|
||||||
|
return self.old_search(compound_domain, self.last_context, self.last_group_by);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
271
app_ui_enhance/static/src/js/tree.js
Normal file
@@ -0,0 +1,271 @@
|
|||||||
|
odoo.define('app_ui_enhance.tree', function (require) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var time = require('web.time');
|
||||||
|
var core = require('web.core');
|
||||||
|
var data = require('web.data');
|
||||||
|
var session = require('web.session');
|
||||||
|
var utils = require('web.utils');
|
||||||
|
var Model = require('web.Model');
|
||||||
|
var ListView = require('web.ListView');
|
||||||
|
var datepicker = require('web.datepicker');
|
||||||
|
var ViewManager = require('web.ViewManager')
|
||||||
|
var _t = core._t;
|
||||||
|
var _lt = core._lt;
|
||||||
|
var QWeb = core.qweb;
|
||||||
|
|
||||||
|
ListView.include({
|
||||||
|
|
||||||
|
init: function(parent, dataset, view_id, options) {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
this.ts_context = dataset.context.tree_search;
|
||||||
|
this.fields_range = dataset.context.fields_range;
|
||||||
|
this.ts_fields = [];
|
||||||
|
},
|
||||||
|
|
||||||
|
on_button_click: function (event) {
|
||||||
|
var self = this;
|
||||||
|
var $target = $(event.target),
|
||||||
|
field, key, first_item;
|
||||||
|
|
||||||
|
field = $target.parent().data('field');
|
||||||
|
key = $target.parent().data('key');
|
||||||
|
|
||||||
|
if (field == -1) {
|
||||||
|
first_item = $target.parent().parent().children('.tgl_first_item.selected');
|
||||||
|
if (!first_item.length) {
|
||||||
|
$target.parent().parent().children('li').removeClass('selected')
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
first_item = $target.parent().parent().children('.tgl_first_item').removeClass('selected');
|
||||||
|
}
|
||||||
|
|
||||||
|
$target.parent().toggleClass('selected');
|
||||||
|
this.tgl_search()
|
||||||
|
event.stopPropagation();
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
render_buttons: function($node) {
|
||||||
|
var self = this;
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
|
||||||
|
var l10n = _t.database.parameters;
|
||||||
|
var datepickers_options = {
|
||||||
|
pickTime: false,
|
||||||
|
startDate: moment({ y: 1900 }),
|
||||||
|
endDate: moment().add(200, "y"),
|
||||||
|
calendarWeeks: true,
|
||||||
|
icons : {
|
||||||
|
time: 'fa fa-clock-o',
|
||||||
|
date: 'fa fa-calendar',
|
||||||
|
up: 'fa fa-chevron-up',
|
||||||
|
down: 'fa fa-chevron-down'
|
||||||
|
},
|
||||||
|
language : moment.locale(),
|
||||||
|
format : time.strftime_to_moment_format(l10n.date_format),
|
||||||
|
}
|
||||||
|
|
||||||
|
self.$buttons.find('.app-search').remove();
|
||||||
|
|
||||||
|
var date_fields = [];
|
||||||
|
// 增加参数控制app_ui_show_search_date
|
||||||
|
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_ui_show_search_date']], ['value']]).then(function (show) {
|
||||||
|
if (show.length >= 1 && (show[0]['value'] == "True")) {
|
||||||
|
_.each(self.columns, function (value, key, list) {
|
||||||
|
if (value.store && value.type === "datetime" || value.type === "date") {
|
||||||
|
date_fields.push([value.name, value.string, value.type]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (date_fields.length > 0) {
|
||||||
|
self.$search_button = $(QWeb.render('odooApp.buttons', {'date_fields': date_fields}))
|
||||||
|
self.$search_button.find('.app_start_date').datetimepicker(datepickers_options);
|
||||||
|
self.$search_button.find('.app_end_date').datetimepicker(datepickers_options);
|
||||||
|
// self.$search_button.find('.app_search_date_rate').click(function() {
|
||||||
|
// self.tgl_search();
|
||||||
|
// });
|
||||||
|
self.$search_button.find('.app_start_date').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_button.find('.app_end_date').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_button.find('.app_select_field').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_button.appendTo(self.$buttons);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
var number_fields = [];
|
||||||
|
|
||||||
|
// 增加参数控制app_ui_show_search_number
|
||||||
|
new Model('ir.config_parameter').call('search_read', [[['key', '=', 'app_ui_show_search_number']], ['value']]).then(function (show) {
|
||||||
|
if (show.length >= 1 && (show[0]['value'] == "True")) {
|
||||||
|
_.each(self.columns, function (value, key, list) {
|
||||||
|
if (value.string && value.string.length > 1 && value.store && (value.type === "integer" || value.type === "float" || value.type === "monetary")) {
|
||||||
|
number_fields.push([value.name, value.string]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (number_fields.length == 0) {
|
||||||
|
if (self.fields_range) {
|
||||||
|
number_fields = self.fields_range;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (number_fields.length > 0) {
|
||||||
|
self.$search_range = $(QWeb.render('odooApp.SearchRange', {'number_fields': number_fields}))
|
||||||
|
// self.$search_range.find('.app_search_date_range').click(function() {
|
||||||
|
// self.tgl_search();
|
||||||
|
// });
|
||||||
|
self.$search_range.find('.app_select_range_field').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_range.find('.app_start_range').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_range.find('.app_end_range').on('change', function () {
|
||||||
|
self.tgl_search();
|
||||||
|
});
|
||||||
|
self.$search_range.appendTo(self.$buttons);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Dropdown list
|
||||||
|
_.each(this.ts_context, function(item){
|
||||||
|
var field = _.find(self.columns, function(column){
|
||||||
|
return column.type == 'many2one' && column.relation && column.name === item.name;
|
||||||
|
});
|
||||||
|
if (field) {
|
||||||
|
self.ts_fields.push(item.name);
|
||||||
|
new Model(field.relation).query(['id', 'display_name']).filter(new data.CompoundDomain(item.domain, field.domain)).context(new data.CompoundContext()).all().then(function (result) {
|
||||||
|
// var single_search = $(QWeb.render('odooApp.selection', {
|
||||||
|
// 'string': item.string,
|
||||||
|
// 'class_name': 'app_item_' + item.name,
|
||||||
|
// 'fields': result,
|
||||||
|
// }));
|
||||||
|
if (!$('.after_control_panel').length) {
|
||||||
|
// $(QWeb.render('odooApp.after_control_panel', {})).appendTo($('.o_control_panel'));
|
||||||
|
// $(QWeb.render('odooApp.after_control_panel', {})).appendTo($('.o_cp_left'));
|
||||||
|
|
||||||
|
// $(QWeb.render('odooApp.after_control_panel', {})).appendTo(self.$buttons);
|
||||||
|
|
||||||
|
var multi_search = $(QWeb.render("TGL.TreeSearch.Item", {'widget': {
|
||||||
|
'string': item.string,
|
||||||
|
'key': item.name,
|
||||||
|
'class_name': 'app_multi_item_' + item.name,
|
||||||
|
'fields': result,
|
||||||
|
}}))
|
||||||
|
|
||||||
|
multi_search.find('li').click(self.on_button_click.bind(self));
|
||||||
|
multi_search.appendTo(self.$buttons);
|
||||||
|
}
|
||||||
|
// single_search.appendTo($('.after_control_panel'));
|
||||||
|
// $('.app_item_' + item.name).on('change', function() {
|
||||||
|
// self.tgl_search();
|
||||||
|
// })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
do_search: function(domain, context, group_by) {
|
||||||
|
var self = this;
|
||||||
|
this.last_domain = domain;
|
||||||
|
this.last_context = context;
|
||||||
|
this.last_group_by = group_by;
|
||||||
|
this.old_search = _.bind(this._super, this);
|
||||||
|
return self.tgl_search();
|
||||||
|
},
|
||||||
|
|
||||||
|
tgl_search: function() {
|
||||||
|
var self = this;
|
||||||
|
var domain = [], value, value_tmp;
|
||||||
|
|
||||||
|
_.each(self.ts_fields, function(field){
|
||||||
|
value = $('.app_item_' + field).val();
|
||||||
|
|
||||||
|
var select_fields = $('.app_multi_item_' + field).children('.selected'),
|
||||||
|
select_value = [];
|
||||||
|
if (select_fields.length > 0) {
|
||||||
|
_.each(select_fields, function(item){
|
||||||
|
value_tmp = $(item).data('field');
|
||||||
|
if (value_tmp > 0) {
|
||||||
|
select_value.push($(item).data('field'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (select_value.length) {
|
||||||
|
domain.push([field, 'in', select_value]);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// 注意,date和datetime型的处理是不同的,已处理完
|
||||||
|
if (self.$search_button) {
|
||||||
|
var start_date = self.$search_button.find('.app_start_date').val(),
|
||||||
|
end_date = self.$search_button.find('.app_end_date').val(),
|
||||||
|
field = self.$search_button.find('.app_select_field').val(),
|
||||||
|
field_type = 'datetime';
|
||||||
|
var tz = session.user_context.tz,
|
||||||
|
start_utc,
|
||||||
|
end_utc;
|
||||||
|
|
||||||
|
_.each(self.columns, function (value, key, list) {
|
||||||
|
if (value.name == field) {
|
||||||
|
field_type = value.type;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
moment.locale(tz);
|
||||||
|
var l10n = _t.database.parameters;
|
||||||
|
if (start_date) {
|
||||||
|
if (field_type === 'date') {
|
||||||
|
//日期类型,无须utc处理
|
||||||
|
start_date = moment(moment(start_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD');
|
||||||
|
domain.push([field, '>=', start_date]);
|
||||||
|
} else {
|
||||||
|
//日期时间,处理utc
|
||||||
|
start_date = moment(moment(start_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD 00:00:00');
|
||||||
|
start_utc = moment(start_date)
|
||||||
|
domain.push([field, '>=', start_utc]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (end_date) {
|
||||||
|
if (field_type === 'date') {
|
||||||
|
end_date = moment(moment(end_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD');
|
||||||
|
domain.push([field, '<=', end_date]);
|
||||||
|
} else {
|
||||||
|
end_date = moment(moment(end_date, time.strftime_to_moment_format(l10n.date_format))).format('YYYY-MM-DD 00:00:00');
|
||||||
|
end_utc = moment(end_date)
|
||||||
|
domain.push([field, '<=', end_utc]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self.$search_range) {
|
||||||
|
var start_range = self.$search_range.find('.app_start_range').val(),
|
||||||
|
end_range = self.$search_range.find('.app_end_range').val(),
|
||||||
|
range_field = self.$search_range.find('.app_select_range_field').val();
|
||||||
|
|
||||||
|
if (start_range) {
|
||||||
|
domain.push([range_field, '>=', parseInt(start_range)]);
|
||||||
|
}
|
||||||
|
if (end_range) {
|
||||||
|
domain.push([range_field, '<=', parseInt(end_range)]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// console.log(domain);
|
||||||
|
var compound_domain = new data.CompoundDomain(self.last_domain, domain);
|
||||||
|
self.dataset.domain = compound_domain.eval();
|
||||||
|
return self.old_search(compound_domain, self.last_context, self.last_group_by);
|
||||||
|
},
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
101
app_ui_enhance/static/src/xml/pivot_view.xml
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<templates id="template" xml:space="preserve">
|
||||||
|
<!--日期类型搜索-->
|
||||||
|
<t t-name="odooApp.buttons">
|
||||||
|
<div class="app-search btn-group btn-group-sm" >
|
||||||
|
<!-- <div style="margin-left: 10px; margin-top: 2px;"> -->
|
||||||
|
<div style="margin-left: 0px; margin-top: 2px; padding-right: 10px;">
|
||||||
|
<span style="float: left;">
|
||||||
|
|
||||||
|
<select class="app_select_field form-control" style="height: 30px;" >
|
||||||
|
<option t-foreach="date_fields" t-as="field" t-att-value="field[0]" t-att-type="field[2]">
|
||||||
|
<t t-esc="field[1]"/>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span style="float: left; margin-left: 2px;">
|
||||||
|
<input style="height: 30px;" class="app_start_date form-control" size="15" placeholder="Start date" type="text" />
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span style="float: left; margin-left: 2px;">
|
||||||
|
<input style="height: 30px;" class="app_end_date form-control" size="15" placeholder="End date" type="text" />
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- <button style="margin-left: 2px; padding: 5px 10px;" class="app_search_date_rate btn btn-primary" title="Field">Lọc</button> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <br></br> -->
|
||||||
|
</t>
|
||||||
|
<!--数值范围搜索-->
|
||||||
|
<t t-name="odooApp.SearchRange">
|
||||||
|
<div class="app-search btn-group btn-group-sm" >
|
||||||
|
<!-- <div style="margin-left: 10px; margin-top: 2px;"> -->
|
||||||
|
<div style="margin-left: 0px; margin-top: 2px; padding-right: 10px;">
|
||||||
|
<span style="float: left;">
|
||||||
|
|
||||||
|
<select class="app_select_range_field form-control" style="height: 30px;" >
|
||||||
|
<option t-foreach="number_fields" t-as="field" t-att-value="field[0]">
|
||||||
|
<t t-esc="field[1]"/>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span style="float: left; margin-left: 2px;">
|
||||||
|
<input style="height: 30px;" class="app_start_range form-control" size="6" placeholder="From" type="text" />
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span style="float: left; margin-left: 2px;">
|
||||||
|
<input style="height: 30px;" class="app_end_range form-control" size="6" placeholder="To" type="text" />
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<!-- <button style="margin-left: 2px; padding: 5px 10px;" class="app_search_date_range btn btn-primary" title="Field">Lọc</button> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br></br>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-name="odooApp.after_control_panel">
|
||||||
|
<!-- <div class="after_control_panel" style="width: 100%; text-align: center;" /> -->
|
||||||
|
<div class="after_control_panel" />
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-name="odooApp.selection">
|
||||||
|
<div class=" btn-group btn-group-sm" >
|
||||||
|
<div style="text-align: left">
|
||||||
|
<strong><span t-esc="string"/></strong>
|
||||||
|
<div style="margin-left: 0px; margin-top: 0px;">
|
||||||
|
|
||||||
|
<select t-att-class="class_name" style="height: 30px;" >
|
||||||
|
<option value="0">All</option>
|
||||||
|
<option t-foreach="fields" t-as="field" t-att-value="field.id">
|
||||||
|
<t t-esc="field.display_name"/>
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-name="TGL.TreeSearch.Placeholder">
|
||||||
|
<div class="treesearch_placeholder" />
|
||||||
|
</t>
|
||||||
|
|
||||||
|
<t t-name="TGL.TreeSearch.Item">
|
||||||
|
<div class="btn-group btn-group-sm tree_search_item" style="padding-right: 2px;">
|
||||||
|
<button class="btn btn-primary dropdown-toggle form-control" data-toggle="dropdown">
|
||||||
|
<t t-esc="widget.string" /> <span class="caret"></span>
|
||||||
|
</button>
|
||||||
|
<ul t-att-class="widget.class_name+' dropdown-menu'" style="max-height: 450px; overflow-y: auto;">
|
||||||
|
<li data-field="-1" class="tgl_first_item selected" ><a>All</a></li>
|
||||||
|
<li t-foreach="widget.fields" t-as="value" t-att-data-field="value.id" t-att-data-key="widget.key">
|
||||||
|
<a><t t-esc="value.display_name"/></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</t>
|
||||||
|
|
||||||
|
|
||||||
|
</templates>
|
||||||
47
app_ui_enhance/views/app_ui_config_settings_view.xml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
<record id="view_app_ui_config_settings" model="ir.ui.view">
|
||||||
|
<field name="name">App Odoo Customize Settings</field>
|
||||||
|
<field name="model">app.ui.config.settings</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="odooApp UI Settings" class="oe_form_configuration">
|
||||||
|
<header>
|
||||||
|
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
|
||||||
|
<button string="Cancel" type="object" name="cancel" class="oe_link" special="cancel"/>
|
||||||
|
</header>
|
||||||
|
<separator string="odoo UI Enhance"/>
|
||||||
|
|
||||||
|
<group string="Search Enhance">
|
||||||
|
<label string="Item to Show"/>
|
||||||
|
<div name="search_show_hide">
|
||||||
|
<div>
|
||||||
|
<field name="app_ui_show_search_date"/>
|
||||||
|
<label for="app_ui_show_search_date"/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<field name="app_ui_show_search_number"/>
|
||||||
|
<label for="app_ui_show_search_number"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</group>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_app_ui_config" model="ir.actions.act_window">
|
||||||
|
<field name="name">UI Enhance</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">app.ui.config.settings</field>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="target">inline</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
id="menu_app_ui_config"
|
||||||
|
parent="app_odoo_customize.menu_app_group"
|
||||||
|
sequence="1"
|
||||||
|
action="action_app_ui_config"
|
||||||
|
groups="base.group_system"/>
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
14
app_ui_enhance/views/template_view.xml
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<template id="assets_backend" inherit_id="web.assets_backend">
|
||||||
|
<xpath expr="." position="inside">
|
||||||
|
<link rel="stylesheet" type="text/css" href="/app_ui_enhance/static/src/css/app_ui_enhance.css"/>
|
||||||
|
<script type="text/javascript" src="/app_ui_enhance/static/src/js/pivot.js"></script>
|
||||||
|
<script type="text/javascript" src="/app_ui_enhance/static/src/js/tree.js"></script>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||