From e64f6c3e4b6333b96b064a9a3125d51dc1fd5def Mon Sep 17 00:00:00 2001 From: ivan deng Date: Mon, 29 Jan 2018 03:14:50 +0800 Subject: [PATCH] update app_ui, allow barcode --- app_ui_enhance/__openerp__.py | 2 +- app_ui_enhance/data/ir_config_parameter.xml | 5 +++++ app_ui_enhance/i18n/zh_CN.po | 14 ++++++++++++-- app_ui_enhance/models/app_ui_config_settings.py | 7 ++++++- app_ui_enhance/models/report.py | 8 +++++++- app_ui_enhance/static/description/index.html | 4 ++-- app_ui_enhance/static/src/css/app_ui_enhance.css | 14 +++++++++++++- .../views/app_ui_config_settings_view.xml | 1 + 8 files changed, 47 insertions(+), 8 deletions(-) diff --git a/app_ui_enhance/__openerp__.py b/app_ui_enhance/__openerp__.py index 630fe234..926633b4 100644 --- a/app_ui_enhance/__openerp__.py +++ b/app_ui_enhance/__openerp__.py @@ -17,8 +17,8 @@ { 'name': 'App Web UI Enhance(Search by date or number range,List background color,Barcode Setting.)', 'version': '10.0.1.0', - 'author': 'Sunpop.cn', 'category': 'web', + 'author': 'Sunpop.cn', 'website': 'http://www.sunpop.cn', 'license': 'AGPL-3', 'sequence': 2, diff --git a/app_ui_enhance/data/ir_config_parameter.xml b/app_ui_enhance/data/ir_config_parameter.xml index 7d8f326d..cb432dd2 100644 --- a/app_ui_enhance/data/ir_config_parameter.xml +++ b/app_ui_enhance/data/ir_config_parameter.xml @@ -13,5 +13,10 @@ app_ui_force_barcode Code128 + + + app_ui_allow_barcode + QR,Standard39 + \ No newline at end of file diff --git a/app_ui_enhance/i18n/zh_CN.po b/app_ui_enhance/i18n/zh_CN.po index 49165dd3..5d5c82a4 100644 --- a/app_ui_enhance/i18n/zh_CN.po +++ b/app_ui_enhance/i18n/zh_CN.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0+e-20171107\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-01-15 13:31+0000\n" -"PO-Revision-Date: 2018-01-15 13:31+0000\n" +"POT-Creation-Date: 2018-01-28 19:12+0000\n" +"PO-Revision-Date: 2018-01-28 19:12+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -23,6 +23,11 @@ msgstr "" msgid "All" msgstr "全部" +#. module: app_ui_enhance +#: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_app_ui_allow_barcode +msgid "Allow Barcode, Seperated by \",\"" +msgstr "允许的条码,用\",\"分隔" + #. module: app_ui_enhance #: model:ir.model,name:app_ui_enhance.model_app_ui_config_settings msgid "App Web UI enhance settings" @@ -63,6 +68,11 @@ msgstr "创建人" msgid "Created on" msgstr "创建时间" +#. module: app_ui_enhance +#: model:ir.model.fields,help:app_ui_enhance.field_app_ui_config_settings_app_ui_allow_barcode +msgid "Default Allow QR and Standard39." +msgstr "建议默认输入 QR,Standard39" + #. module: app_ui_enhance #: model:ir.model.fields,field_description:app_ui_enhance.field_app_ui_config_settings_display_name msgid "Display Name" diff --git a/app_ui_enhance/models/app_ui_config_settings.py b/app_ui_enhance/models/app_ui_config_settings.py index 204fad7e..3a4bede4 100644 --- a/app_ui_enhance/models/app_ui_config_settings.py +++ b/app_ui_enhance/models/app_ui_config_settings.py @@ -63,17 +63,21 @@ class AppUiConfigSettings(models.TransientModel): ('USPS_4State', 'USPS_4State'), ], string='Force all Odoo Barcode to:', help=u"Set Odoo Default to use the barcode odoo define in report(EAN13).") + app_ui_allow_barcode = fields.Char('Allow Barcode, Seperated by ","', help=u"Default Allow QR and Standard39.") + @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 app_ui_force_barcode = ir_config.get_param('app_ui_force_barcode') + app_ui_allow_barcode = ir_config.get_param('app_ui_allow_barcode') return dict( app_ui_show_search_date=app_ui_show_search_date, app_ui_show_search_number=app_ui_show_search_number, - app_ui_force_barcode=app_ui_force_barcode + app_ui_force_barcode=app_ui_force_barcode, + app_ui_allow_barcode=app_ui_allow_barcode ) @api.multi @@ -83,4 +87,5 @@ class AppUiConfigSettings(models.TransientModel): 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") ir_config.set_param("app_ui_force_barcode", self.app_ui_force_barcode or "Default") + ir_config.set_param("app_ui_allow_barcode", self.app_ui_allow_barcode or "") return True diff --git a/app_ui_enhance/models/report.py b/app_ui_enhance/models/report.py index ee4b1f13..d7082d88 100644 --- a/app_ui_enhance/models/report.py +++ b/app_ui_enhance/models/report.py @@ -23,7 +23,13 @@ class Report(models.Model): def barcode(self, barcode_type, value, width=600, height=100, humanreadable=0): ir_config = self.env['ir.config_parameter'] app_ui_force_barcode = ir_config.get_param('app_ui_force_barcode', default='Default') - if app_ui_force_barcode or app_ui_force_barcode == 'Default': + app_ui_allow_barcode = ir_config.get_param('app_ui_allow_barcode', default='') + allow = app_ui_allow_barcode.strip(',').split(',') + allowtype = tuple(allow) + if not app_ui_force_barcode or app_ui_force_barcode == 'Default': + return super(Report, self).barcode(barcode_type, value, width, height, humanreadable) + # 在允许的例外列表内 + elif barcode_type in allowtype: return super(Report, self).barcode(barcode_type, value, width, height, humanreadable) else: return super(Report, self).barcode(app_ui_force_barcode, value, width, height, humanreadable) diff --git a/app_ui_enhance/static/description/index.html b/app_ui_enhance/static/description/index.html index 79e7be93..b5f35b0a 100644 --- a/app_ui_enhance/static/description/index.html +++ b/app_ui_enhance/static/description/index.html @@ -1,7 +1,7 @@
-

App Web UI Enhance(Search by date or number range,List background color,Barcode Setting.)

+

App Search By Date or Number Range

Please install app_odoo_customize First.

This moduld allows user to Search by date or number range in List view and Pivot view.

@@ -55,7 +55,7 @@

There are 2 way to setup

1.Go to Menu: Settings->odooApp->UI Enhance

Setup what you need

-
+

2. Go to Menu: Settings->Technical->Parameters->System Parameters

diff --git a/app_ui_enhance/static/src/css/app_ui_enhance.css b/app_ui_enhance/static/src/css/app_ui_enhance.css index a2203192..a3ca48ad 100644 --- a/app_ui_enhance/static/src/css/app_ui_enhance.css +++ b/app_ui_enhance/static/src/css/app_ui_enhance.css @@ -10,7 +10,19 @@ content: ""; } /* -强制表格滚动,企业版中生效 +list标头不换行 +*/ +.table-responsive { + white-space: nowrap !important; +} +/* +sheet全宽 +*/ +.o_form_view .o_form_sheet_bg .o_form_sheet { + max-width: 98%!important; +} +/* +强制表格滚动,企业版/社区版中生效 */ .force_scroll .table-responsive { diff --git a/app_ui_enhance/views/app_ui_config_settings_view.xml b/app_ui_enhance/views/app_ui_config_settings_view.xml index 17ae2750..7e9241ab 100644 --- a/app_ui_enhance/views/app_ui_config_settings_view.xml +++ b/app_ui_enhance/views/app_ui_config_settings_view.xml @@ -27,6 +27,7 @@ +