This commit is contained in:
Ivan Office
2023-10-23 14:01:32 +08:00
parent 6e6d582893
commit 85cccab030
12 changed files with 255 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-

View File

@@ -0,0 +1,34 @@
{
'name': 'App Customize Columns of List (Tree) View Dynamic',
'version': '11.0.1.6',
'author': '广州欧度智能',
'category': 'Productivity',
'website': 'http://www.odooapp.cn',
'sequence': 2,
'summary': 'App Customize columns of List (Tree) View. Dynamic list.',
'description': """
App Customize Columns of List (Tree) View
============
App Customize Columns of List (Tree) View module is made to show/hide the columns on the list/tree view of Odoo. After installing the module, a "Set Columns" button will be show to the list view.
You can customize every odoo list/tree view easily.
This module is ready for Community and Enterprise Edition.
""",
'images': ['static/description/sales_com.png'
],
'depends': ['web'],
'data': [
'views/listview_button.xml',
],
'demo': [],
'test': [
],
'installable': True,
'application': True,
'auto_install': False,
'qweb': ['static/src/xml/listview_button_view.xml'],
}

View File

@@ -0,0 +1,24 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * apps_material_backend_theme
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0c\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-07 08:57+0000\n"
"PO-Revision-Date: 2016-09-07 08:57+0000\n"
"Last-Translator: Ivan Deng <300883@qq.com>, 2017\n"
"Language-Team: Chinese (China) (https://www.transifex.com/odoo/teams/41243/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#. module: app_dynamic_list
#. openerp-web
#: code:addons/apps_material_backend_theme/static/src/xml/listview_button_view.xml:121
#, python-format
msgid "Set Columns"
msgstr "显示列"

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

View File

@@ -0,0 +1,62 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Customize hide/show the columns on the list (tree) view dynamically</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 customize columns dynamically in list (tree) view of any object of any
installed module. </p>
<br>
<p>"Set Columns" button contains all field(s) in dropdown with checkbox which will exist in
list view of current object. So if user wants to show/hide any field, then he/she has to just do
check/uncheck that respective checkbox besides field name in dropdown list and then just click on
"Apply" button.</p>
</div>
</div>
</div>
<div class="oe_row oe_spaced">
<div class="oe_demo"
style=" margin: 60px auto 0; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%;">
<ul>
<li><p class='oe_mt32'>Sales leads in Enterprise Edition</p></li>
</ul>
</div>
<div class="oe_demo oe_picture oe_screenshot">
<img src="sales_ent.png" style="border:1px solid black"/>
<br/>
</div>
<div class="oe_demo"
style=" margin: 60px auto 0; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%;">
<ul>
<li><p class='oe_mt32'>Sales leads in Community Edition</p></li>
</ul>
</div>
<div class="oe_demo oe_picture oe_screenshot">
<img src="sales_com.png" style="border:1px solid black"/>
<br/>
</div>
</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>
</div>
</div>
</div>
</section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

View File

View File

@@ -0,0 +1,97 @@
odoo.define('app_dynamic_list.shcolumns', function (require) {
"use strict";
var core = require('web.core');
var ListView = require('web.ListView');
var QWeb = core.qweb;
ListView.include({
reload: function () {
this.setup_columns(this.fields_view.fields, this.grouped);
this.$el.html(QWeb.render(this._template, this));
return this.reload_content();
},
render_buttons: function($node) {
var self = this;
this._super($node);
this.$buttons.find('.oe_select_columns').click(this.proxy('my_setup_columns'));
this.$buttons.find('.oe_dropdown_btn').click(this.proxy('hide_show_columns'));
this.$buttons.find('.dropdown-menu').click(this.proxy('stop_event'));
},
my_setup_columns: function (fields, grouped) {
$("#showcb").toggle();
var getcb = document.getElementById('showcb');
this.visible_columns = _.filter(this.columns, function (column) {
var firstcheck = document.getElementById(column.id);
if(firstcheck == null)
{
var li= document.createElement("li");
var description = document.createTextNode(column.string);
var checkbox = document.createElement("input");
checkbox.id = column.id;
checkbox.type = "checkbox";
checkbox.name = "cb";
if(column.invisible !== '1')
{
checkbox.checked = true;
}
li.appendChild(checkbox);
li.appendChild(description);
getcb.appendChild(li);
}
else
{
if(column.invisible !== '1')
{
firstcheck.checked = true;
}
else
{
firstcheck.checked = false;
}
}
});
},
stop_event : function(e)
{
e.stopPropagation();
},
hide_show_columns : function()
{
$("#showcb").hide();
this.setup_columns(this.fields_view.fields, this.grouped);
this.$el.html(QWeb.render(this._template, this));
return this.reload_content();
},
setup_columns: function (fields, grouped) {
this._super(fields, grouped);
this.visible_columns = _.filter(this.columns, function (column) {
var cbid = document.getElementById(column.id);
if(cbid !== null)
{
var cbid = cbid.checked;
if(cbid !== false)
{
column.invisible = '2';
}
else
{
column.invisible = '1';
}
}
return column.invisible !== '1';
});
this.aggregate_columns = _(this.visible_columns).invoke('to_aggregate');
},
});
$(document).click(function(){
$("#showcb").hide();
});
});

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<templates t-name="selectcolumns">
<t t-extend="ListView.buttons">
<t t-jquery="button.o_list_button_add" t-operation="after">
<div class="btn-group o_dropdown">
<button name="select_columns" id="select_columns"
class="oe_select_columns btn btn-default btn-sm dropdown-toggle"
data-toggle="dropdown">
Set Columns
<span class="caret"></span>
</button>
<ul id="showcb" class="dropdown-menu" style="padding:10px">
<li>
<button name="apply" id="apply" class="oe_dropdown_btn btn btn-primary btn-block">
Apply
</button>
</li>
</ul>
</div>
</t>
</t>
</templates>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="assets_backend" name="listview" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/app_dynamic_list/static/src/css/my.css"/>
<script type="text/javascript" src="/app_dynamic_list/static/src/js/dynamic_list.js"></script>
</xpath>
</template>
</data>
</openerp>