diff --git a/app_dynamic_list/__init__.py b/app_dynamic_list/__init__.py new file mode 100644 index 00000000..faaaf799 --- /dev/null +++ b/app_dynamic_list/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + + diff --git a/app_dynamic_list/__openerp__.py b/app_dynamic_list/__openerp__.py new file mode 100644 index 00000000..35586072 --- /dev/null +++ b/app_dynamic_list/__openerp__.py @@ -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'], +} + diff --git a/app_dynamic_list/i18n/zh_CN.po b/app_dynamic_list/i18n/zh_CN.po new file mode 100644 index 00000000..c07d57f0 --- /dev/null +++ b/app_dynamic_list/i18n/zh_CN.po @@ -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 "显示列" diff --git a/app_dynamic_list/images/dynamiclist_homepage.jpg b/app_dynamic_list/images/dynamiclist_homepage.jpg new file mode 100644 index 00000000..5563db16 Binary files /dev/null and b/app_dynamic_list/images/dynamiclist_homepage.jpg differ diff --git a/app_dynamic_list/static/description/icon.png b/app_dynamic_list/static/description/icon.png new file mode 100644 index 00000000..2a04f219 Binary files /dev/null and b/app_dynamic_list/static/description/icon.png differ diff --git a/app_dynamic_list/static/description/index.html b/app_dynamic_list/static/description/index.html new file mode 100644 index 00000000..f75d97bc --- /dev/null +++ b/app_dynamic_list/static/description/index.html @@ -0,0 +1,62 @@ +
+
+
+

Customize hide/show the columns on the list (tree) view dynamically

+
+

This moduld allows user to customize columns dynamically in list (tree) view of any object of any + installed module.

+ +
+

"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.

+
+
+
+ + +
+ +
+
    +
  • Sales leads in Enterprise Edition

  • +
+
+
+ +
+
+ +
+
    +
  • Sales leads in Community Edition

  • +
+
+ +
+ +
+
+
+ +
+
+
+
+

Technical Help & Support

+
+
+
+

+ For any type of technical help & support requests, Feel free to contact us

+ + guohuadeng@hotmail.com +
+
+
+
diff --git a/app_dynamic_list/static/description/sales_com.png b/app_dynamic_list/static/description/sales_com.png new file mode 100644 index 00000000..48b199f5 Binary files /dev/null and b/app_dynamic_list/static/description/sales_com.png differ diff --git a/app_dynamic_list/static/description/sales_ent.png b/app_dynamic_list/static/description/sales_ent.png new file mode 100644 index 00000000..55986b90 Binary files /dev/null and b/app_dynamic_list/static/description/sales_ent.png differ diff --git a/app_dynamic_list/static/src/css/my.css b/app_dynamic_list/static/src/css/my.css new file mode 100644 index 00000000..e69de29b diff --git a/app_dynamic_list/static/src/js/dynamic_list.js b/app_dynamic_list/static/src/js/dynamic_list.js new file mode 100644 index 00000000..dd4f8470 --- /dev/null +++ b/app_dynamic_list/static/src/js/dynamic_list.js @@ -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(); +}); + +}); diff --git a/app_dynamic_list/static/src/xml/listview_button_view.xml b/app_dynamic_list/static/src/xml/listview_button_view.xml new file mode 100644 index 00000000..a5c0e58f --- /dev/null +++ b/app_dynamic_list/static/src/xml/listview_button_view.xml @@ -0,0 +1,24 @@ + + + + + +
+ + + +
+
+
+
diff --git a/app_dynamic_list/views/listview_button.xml b/app_dynamic_list/views/listview_button.xml new file mode 100644 index 00000000..fdad6af3 --- /dev/null +++ b/app_dynamic_list/views/listview_button.xml @@ -0,0 +1,11 @@ + + + + + +