diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..35410cac --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..b245076c --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +__manifest__.py \ No newline at end of file diff --git a/.idea/jikimo_sf.iml b/.idea/jikimo_sf.iml new file mode 100644 index 00000000..735af015 --- /dev/null +++ b/.idea/jikimo_sf.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..74e50a18 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..94a25f7f --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/quality/.idea/.gitignore b/quality/.idea/.gitignore new file mode 100644 index 00000000..35410cac --- /dev/null +++ b/quality/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/quality/.idea/inspectionProfiles/Project_Default.xml b/quality/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..6945e437 --- /dev/null +++ b/quality/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,49 @@ + + + + \ No newline at end of file diff --git a/quality/.idea/inspectionProfiles/profiles_settings.xml b/quality/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/quality/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/quality/.idea/misc.xml b/quality/.idea/misc.xml new file mode 100644 index 00000000..d56657ad --- /dev/null +++ b/quality/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/quality/.idea/modules.xml b/quality/.idea/modules.xml new file mode 100644 index 00000000..45662f75 --- /dev/null +++ b/quality/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/quality/.idea/quality.iml b/quality/.idea/quality.iml new file mode 100644 index 00000000..d0876a78 --- /dev/null +++ b/quality/.idea/quality.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/quality/.idea/vcs.xml b/quality/.idea/vcs.xml new file mode 100644 index 00000000..6c0b8635 --- /dev/null +++ b/quality/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/sf_base/models/base.py b/sf_base/models/base.py index bf46344f..1abc5622 100644 --- a/sf_base/models/base.py +++ b/sf_base/models/base.py @@ -259,3 +259,14 @@ class CuttingToolType(models.Model): brand_id = fields.Many2one('sf.machine.brand', string='品牌') remark = fields.Text('备注') active = fields.Boolean('有效', default=True) + +class MachineToolCategory(models.Model): + _name = 'sf.machine_tool.category' + _description = '机床类型' + + code = fields.Char('编码') + name = fields.Char('名称') + remark = fields.Text('备注') + category = fields.Selection([('shukong', u'数控'), ('putong', u'普通')], string=u'机床类别', + default='shukong') + diff --git a/sf_base/security/ir.model.access.csv b/sf_base/security/ir.model.access.csv index 7c13d58d..6798bfd5 100644 --- a/sf_base/security/ir.model.access.csv +++ b/sf_base/security/ir.model.access.csv @@ -15,7 +15,7 @@ access_sf_tray,sf_tray,model_sf_tray,base.group_user,1,1,1,1 access_sf_supplier_sort,sf_supplier_sort,model_sf_supplier_sort,base.group_user,1,1,1,1 access_sf_production_process_parameter,sf_production_process_parameter,model_sf_production_process_parameter,base.group_user,1,1,1,1 access_sf_production_process_category,sf_production_process_category,model_sf_production_process_category,base.group_user,1,1,1,1 - +access_sf_machine_tool_category,sf_machine_tool_category,model_sf_machine_tool_category,base.group_user,1,1,1,1 diff --git a/sf_base/views/base_view.xml b/sf_base/views/base_view.xml index 6dffe5e0..3eb49034 100644 --- a/sf_base/views/base_view.xml +++ b/sf_base/views/base_view.xml @@ -169,6 +169,70 @@ + #------------------机床类型------------------ + + + search.sf.machine_tool.category + sf.machine_tool.category + + + + + + + + + tree.sf.machine_tool.category + sf.machine_tool.category + + + + + + + + + + + + form.sf.machine_tool.category + sf.machine_tool.category + +
+ + + + + + + + + + + + + + + + +
+
+
+ + + 机床类型 + ir.actions.act_window + sf.machine_tool.category + tree,form + +

+ [机床型号] 还没有哦!点左上角的[创建]按钮,沙发归你了! +

+

+

+
+
#------------------刀具型号------------------ diff --git a/sf_base/views/menu_view.xml b/sf_base/views/menu_view.xml index cb02aca2..e011a29d 100644 --- a/sf_base/views/menu_view.xml +++ b/sf_base/views/menu_view.xml @@ -120,6 +120,12 @@ name="机床型号" sequence="1" action="action_sf_machine_tool_type"/> + -1 + + + 同步资源库机床型号 + + code + model.sync_machine_tool_category() + 1 + days + -1 + + \ No newline at end of file diff --git a/sf_mrs_connect/models/res_config_setting.py b/sf_mrs_connect/models/res_config_setting.py index 774fcc4e..b657c5a1 100644 --- a/sf_mrs_connect/models/res_config_setting.py +++ b/sf_mrs_connect/models/res_config_setting.py @@ -38,6 +38,8 @@ class ResConfigSettings(models.TransientModel): _logger.info("同步资源库控制系统") self.env['sf.machine_tool.type'].sync_all_machine_tool_type() _logger.info("同步资源库机床型号") + self.env['sf.machine_tool.category'].sync_all_machine_tool_category() + _logger.info("同步资源库机床类型") self.env['sf.cutting_tool.category'].sync_all_cutting_tool_category() _logger.info("同步资源库刀具类别") self.env['sf.cutting_tool.type'].sync_all_cutting_tool_type() diff --git a/sf_mrs_connect/models/sync_common.py b/sf_mrs_connect/models/sync_common.py index 21f75741..8a1c258a 100644 --- a/sf_mrs_connect/models/sync_common.py +++ b/sf_mrs_connect/models/sync_common.py @@ -1086,3 +1086,64 @@ class sfProductionProcessParameter(models.Model): }) else: raise ValidationError("认证未通过") + +class MachineToolCategory(models.Model): + _inherit = 'sf.machine_tool.category' + _description = '机床类型' + url = '/api/machine_tool_category/list' + + # 定时同步机床类型 + def sync_machine_tool_category(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + for item in result['machine_tool_category_yesterday_list']: + brand = self.env['sf.machine_tool.category'].search( + [("code", '=', item['code'])]) + if brand: + brand.name = item['name'], + brand.code = item['code'], + brand.category = item['category'], + brand.remark = item['remark'] + + else: + brand.name = item['name'], + brand.code = item['code'], + brand.category = item['category'], + brand.remark = item['remark'] + else: + raise ValidationError("认证未通过") + + # 同步所有机床类型 + def sync_all_machine_tool_category(self): + sf_sync_config = self.env['res.config.settings'].get_values() + token = sf_sync_config['token'] + sf_secret_key = sf_sync_config['sf_secret_key'] + headers = Common.get_headers(self, token, sf_secret_key) + + strUrl = sf_sync_config['sf_url'] + self.url + r = requests.post(strUrl, json={}, data=None, headers=headers) + r = r.json() + result = json.loads(r['result']) + if result['status'] == 1: + for item in result['machine_tool_category_all_list']: + brand = self.env['sf.machine_tool.category'].search( + [("code", '=', item['code'])]) + if not brand: + self.env['sf.machine_tool.category'].create({ + "name": item['name'], + "code": item['code'], + "category": item['category'], + "remark": item['remark'], + + }) + else: + raise ValidationError("认证未通过") + diff --git a/web_copy_confirm/README.rst b/web_copy_confirm/README.rst new file mode 100644 index 00000000..4ff55c86 --- /dev/null +++ b/web_copy_confirm/README.rst @@ -0,0 +1,84 @@ +================================================= +Show confirmation dialogue before copying records +================================================= + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/15.0/web_copy_confirm + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-15-0/web-15-0-web_copy_confirm + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/15.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module will show a confirmation dialog when the user selects the +`Duplicate` option from the `Action` dropdown in the standard form view. + +**Table of contents** + +.. contents:: + :local: + +Changelog +========= + +14.0.1.0.0 (2020-01-04) +~~~~~~~~~~~~~~~~~~~~~~~ +* [PORT] Ported to V14 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Dynapps +* YiZuo + +Contributors +~~~~~~~~~~~~ + +* Stefan Rijnhart +* Robin Conjour +* PengYB + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_copy_confirm/__init__.py b/web_copy_confirm/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_copy_confirm/__manifest__.py b/web_copy_confirm/__manifest__.py new file mode 100644 index 00000000..3ffe5334 --- /dev/null +++ b/web_copy_confirm/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright (C) 2018 DynApps +# Copyright (C) 2022 Yizuo +# @author Stefan Rijnhart +# @author Robin Conjour +# PengYB(YiZuo) use OWL Rewrite. +# @author PengYB +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +{ + "name": "Show confirmation dialogue before copying records", + "version": "16.0.1.0.0", + "author": "Dynapps,YiZuo, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "license": "AGPL-3", + "category": "Tools", + "depends": [ + "web", + ], + "assets": { + "web.assets_backend": [ + "web_copy_confirm/static/src/js/web_copy_confirm.js", + ], + "web.qunit_suite_tests": [ + "web_copy_confirm/static/tests/**/*", + ], + }, + "installable": True, +} diff --git a/web_copy_confirm/i18n/de.po b/web_copy_confirm/i18n/de.po new file mode 100644 index 00000000..d9ef7a0e --- /dev/null +++ b/web_copy_confirm/i18n/de.po @@ -0,0 +1,31 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_copy_confirm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-10-13 20:46+0000\n" +"Last-Translator: Corneliuus \n" +"Language-Team: none\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_copy_confirm +#. openerp-web +#: code:addons/web_copy_confirm/static/src/js/web_copy_confirm.js:0 +#, python-format +msgid "Are you sure that you would like to copy this record?" +msgstr "Sind Sie sicher, dass Sie diesen Datensatz kopieren möchten?" + +#. module: web_copy_confirm +#. openerp-web +#: code:addons/web_copy_confirm/static/src/js/web_copy_confirm.js:0 +#, python-format +msgid "Duplicate" +msgstr "Duplizieren" diff --git a/web_copy_confirm/i18n/zh_CN.po b/web_copy_confirm/i18n/zh_CN.po new file mode 100644 index 00000000..1740c78f --- /dev/null +++ b/web_copy_confirm/i18n/zh_CN.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_copy_confirm +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-11-20 08:18+0000\n" +"PO-Revision-Date: 2022-11-20 16:21+0800\n" +"Last-Translator: \n" +"Language-Team: PengYB \n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.2\n" + +#. module: web_copy_confirm +#. openerp-web +#: code:addons/web_copy_confirm/static/src/js/web_copy_confirm.js:0 +#, python-format +msgid "Are you sure that you would like to copy this record?" +msgstr "你确定要复制这个记录吗?" diff --git a/web_copy_confirm/readme/CONTRIBUTORS.rst b/web_copy_confirm/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..4d5fbd04 --- /dev/null +++ b/web_copy_confirm/readme/CONTRIBUTORS.rst @@ -0,0 +1,3 @@ +* Stefan Rijnhart +* Robin Conjour +* PengYB diff --git a/web_copy_confirm/readme/DESCRIPTION.rst b/web_copy_confirm/readme/DESCRIPTION.rst new file mode 100644 index 00000000..926f7500 --- /dev/null +++ b/web_copy_confirm/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module will show a confirmation dialog when the user selects the +`Duplicate` option from the `Action` dropdown in the standard form view. diff --git a/web_copy_confirm/readme/HISTORY.rst b/web_copy_confirm/readme/HISTORY.rst new file mode 100644 index 00000000..3d7e14b3 --- /dev/null +++ b/web_copy_confirm/readme/HISTORY.rst @@ -0,0 +1,9 @@ +14.0.1.0.0 (2020-01-04) +~~~~~~~~~~~~~~~~~~~~~~~ +* [PORT] Ported to V14 + + +16.0.1.0.0 (2020-01-04) +~~~~~~~~~~~~~~~~~~~~~~~ +* [PORT] Ported to V16 +* PengYB use OWL Rewrite. \ No newline at end of file diff --git a/web_copy_confirm/readme/newsfragments/.gitkeep b/web_copy_confirm/readme/newsfragments/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/web_copy_confirm/static/description/icon.png b/web_copy_confirm/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_copy_confirm/static/description/icon.png differ diff --git a/web_copy_confirm/static/description/index.html b/web_copy_confirm/static/description/index.html new file mode 100644 index 00000000..42161b84 --- /dev/null +++ b/web_copy_confirm/static/description/index.html @@ -0,0 +1,434 @@ + + + + + + +Show confirmation dialogue before copying records + + + +
+

Show confirmation dialogue before copying records

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

This module will show a confirmation dialog when the user selects the +Duplicate option from the Action dropdown in the standard form view.

+

Table of contents

+ +
+

Changelog

+
+

14.0.1.0.0 (2020-01-04)

+
    +
  • [PORT] Ported to V14
  • +
+
+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Dynapps
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_copy_confirm/static/src/js/web_copy_confirm.js b/web_copy_confirm/static/src/js/web_copy_confirm.js new file mode 100644 index 00000000..86d9bad8 --- /dev/null +++ b/web_copy_confirm/static/src/js/web_copy_confirm.js @@ -0,0 +1,31 @@ +/** @odoo-module **/ + +// Copyright (C) 2018 DynApps +// Copyright (C) 2022 Yizuo +// @author Stefan Rijnhart +// @author Robin Conjour +// PengYB(YiZuo) use OWL Rewrite. +// @author PengYB +// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import { FormController } from "@web/views/form/form_controller"; +import { _lt } from "@web/core/l10n/translation"; +import { ConfirmationDialog } from "@web/core/confirmation_dialog/confirmation_dialog"; +import { patch } from "@web/core/utils/patch"; + +patch(FormController.prototype,"Duplicate Confirm",{ + + async duplicateRecord() { + const dialogProps = { + body: _lt("Are you sure that you would like to copy this record?"), + confirm: async () => { + await this.model.root.duplicate(); +// if (!this.model.root.resId) { +// this.env.config.historyBack(); +// } + }, + cancel: () => {}, + }; + this.dialogService.add(ConfirmationDialog, dialogProps); + } +}); \ No newline at end of file diff --git a/web_copy_confirm/static/tests/confirm_tests.js b/web_copy_confirm/static/tests/confirm_tests.js new file mode 100644 index 00000000..bd1f0e90 --- /dev/null +++ b/web_copy_confirm/static/tests/confirm_tests.js @@ -0,0 +1,91 @@ +odoo.define("web_copy_confirm.confirm_tests", function (require) { + "use strict"; + + /* global QUnit*/ + + var FormView = require("web.FormView"); + var testUtils = require("web.test_utils"); + + var createView = testUtils.createView; + + QUnit.module( + "web_copy_confirm", + { + beforeEach: function () { + this.data = { + partner: { + fields: { + display_name: { + string: "STRING", + type: "char", + default: "Name", + }, + }, + records: [ + { + id: 1, + display_name: "first partner", + }, + ], + onchanges: {}, + }, + }; + }, + }, + function () { + QUnit.test("ask confirmation before duplicate", async function (assert) { + assert.expect(4); + const form = await createView({ + View: FormView, + model: "partner", + data: this.data, + arch: ` +
+ + + `, + viewOptions: { + mode: "edit", + }, + res_id: 1, + }); + + // Validate that partner2 does not exist + assert.strictEqual( + typeof form.model.localData.partner_2, + "undefined", + "Partner 2 shouldn't exist" + ); + + // Trigger onDuplicateRecordConfirm + await form._onDuplicateRecordConfirm(); + + // Validate dialog + var confirmDialog = form.getChildren().pop(); + assert.strictEqual( + confirmDialog.buttons[0].text, + "Ok", + "Ok button is available" + ); + assert.strictEqual( + confirmDialog.$content[0].innerHTML, + "Are you sure that you would like to copy this record?", + "Confirmation text is available" + ); + + // Confirm dialog + await confirmDialog.buttons[0].click(); + + // Validate that copy is created + assert.strictEqual( + form.model.localData.partner_2.data.display_name, + "first partner (copy)", + "Copy is created" + ); + + await testUtils.nextTick(); + form.destroy(); + }); + } + ); +}); diff --git a/web_environment_ribbon/README.rst b/web_environment_ribbon/README.rst new file mode 100644 index 00000000..eeb27e98 --- /dev/null +++ b/web_environment_ribbon/README.rst @@ -0,0 +1,98 @@ +====================== +Web Environment Ribbon +====================== + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/16.0/web_environment_ribbon + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_environment_ribbon + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/162/16.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Mark a Test Environment with a red ribbon on the top left corner in every page + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +* You can change the ribbon's name ("TEST") by editing the default system + parameter "ribbon.name" (in the menu Settings > Parameters > System + Parameters) To hide the ribbon, set this parameter to "False" or delete it. +* You can customize the ribbon color and background color through system + parameters: "ribbon.color", "ribbon.background.color". Fill with valid CSS + colors or just set to "False" to use default values. +* You can add the database name in the ribbon by adding "{db_name}" in the + system parameter "ribbon.name". + +Usage +===== + +To use this module, you need only to install it. After installation, a red +ribbon will be visible on top left corner of every Odoo backend page + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Francesco OpenCode Apruzzese +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* Francesco Apruzzese +* Javi Melendez +* Antonio Espinosa +* Thomas Binsfeld +* Xavier Jiménez +* Dennis Sluijk +* Eric Lembregts + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_environment_ribbon/__init__.py b/web_environment_ribbon/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/web_environment_ribbon/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_environment_ribbon/__manifest__.py b/web_environment_ribbon/__manifest__.py new file mode 100644 index 00000000..9d99f184 --- /dev/null +++ b/web_environment_ribbon/__manifest__.py @@ -0,0 +1,27 @@ +# Copyright 2015 Francesco OpenCode Apruzzese +# Copyright 2016 Antonio Espinosa +# Copyright 2017 Thomas Binsfeld +# Copyright 2017 Xavier Jiménez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + "name": "Web Environment Ribbon", + "version": "16.0.1.0.0", + "category": "Web", + "author": "Francesco OpenCode Apruzzese, " + "Tecnativa, " + "Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web", + "license": "AGPL-3", + "depends": ["web"], + "data": [ + "data/ribbon_data.xml", + ], + "auto_install": False, + "installable": True, + "assets": { + "web.assets_common": [ + "web_environment_ribbon/static/**/*", + ], + }, +} diff --git a/web_environment_ribbon/data/ribbon_data.xml b/web_environment_ribbon/data/ribbon_data.xml new file mode 100644 index 00000000..72a50249 --- /dev/null +++ b/web_environment_ribbon/data/ribbon_data.xml @@ -0,0 +1,20 @@ + + + + + + ribbon.name + ({db_name})]]> + + + + ribbon.color + #f0f0f0 + + + + ribbon.background.color + rgba(255,0,0,.6) + + diff --git a/web_environment_ribbon/i18n/ca.po b/web_environment_ribbon/i18n/ca.po new file mode 100644 index 00000000..6011c8b8 --- /dev/null +++ b/web_environment_ribbon/i18n/ca.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2020-02-02 22:13+0000\n" +"Last-Translator: eduardgm \n" +"Language-Team: none\n" +"Language: ca\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Nom mostrat" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Última modificació el" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "Backend \"Web Environment Ribbon\"" diff --git a/web_environment_ribbon/i18n/de.po b/web_environment_ribbon/i18n/de.po new file mode 100644 index 00000000..69c8fd29 --- /dev/null +++ b/web_environment_ribbon/i18n/de.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +# Translators: +# Niki Waibel , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-13 16:06+0000\n" +"PO-Revision-Date: 2020-07-22 12:19+0000\n" +"Last-Translator: c2cdidier \n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.10\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Anzeigename" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Zuletzt geändert am" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "Web-Umgebung Ribbon-Backend" diff --git a/web_environment_ribbon/i18n/es.po b/web_environment_ribbon/i18n/es.po new file mode 100644 index 00000000..f38990cc --- /dev/null +++ b/web_environment_ribbon/i18n/es.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-08-04 17:44+0000\n" +"Last-Translator: eduardgm \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 3.7.1\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Nombre mostrado" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Última modificación el" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "Backend \"Web Environment Ribbon\"" diff --git a/web_environment_ribbon/i18n/fr.po b/web_environment_ribbon/i18n/fr.po new file mode 100644 index 00000000..5125212c --- /dev/null +++ b/web_environment_ribbon/i18n/fr.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +# Translators: +# OCA Transbot , 2017 +# Quentin THEURET , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-26 02:44+0000\n" +"PO-Revision-Date: 2017-07-26 02:44+0000\n" +"Last-Translator: Quentin THEURET , 2017\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Dernière modification le" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "Backend du bandeau de l'environnement Web" diff --git a/web_environment_ribbon/i18n/hr.po b/web_environment_ribbon/i18n/hr.po new file mode 100644 index 00000000..836e2311 --- /dev/null +++ b/web_environment_ribbon/i18n/hr.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +# Translators: +# Bole , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-13 16:06+0000\n" +"PO-Revision-Date: 2017-07-13 16:06+0000\n" +"Last-Translator: Bole , 2017\n" +"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" +"Language: hr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Naziv za prikaz" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Zadnje modificirano" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "" diff --git a/web_environment_ribbon/i18n/nl.po b/web_environment_ribbon/i18n/nl.po new file mode 100644 index 00000000..4185a0aa --- /dev/null +++ b/web_environment_ribbon/i18n/nl.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-05-17 20:47+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Weergavenaam" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Laatst Gewijzigd op" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "Web Environment Ribbon Backend" diff --git a/web_environment_ribbon/i18n/nl_NL.po b/web_environment_ribbon/i18n/nl_NL.po new file mode 100644 index 00000000..d66b5b3f --- /dev/null +++ b/web_environment_ribbon/i18n/nl_NL.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +# Translators: +# Peter Hageman , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-13 16:06+0000\n" +"PO-Revision-Date: 2021-04-22 15:47+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/" +"23907/nl_NL/)\n" +"Language: nl_NL\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Weergavenaam" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Laatst bijgewerkt op" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "" diff --git a/web_environment_ribbon/i18n/pt.po b/web_environment_ribbon/i18n/pt.po new file mode 100644 index 00000000..486684bc --- /dev/null +++ b/web_environment_ribbon/i18n/pt.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-08-12 11:44+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.7.1\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Nome a Exibir" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Última Modificação em" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "" diff --git a/web_environment_ribbon/i18n/pt_BR.po b/web_environment_ribbon/i18n/pt_BR.po new file mode 100644 index 00000000..539afa61 --- /dev/null +++ b/web_environment_ribbon/i18n/pt_BR.po @@ -0,0 +1,41 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +# Translators: +# Rodrigo de Almeida Sottomaior Macedo , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-13 16:06+0000\n" +"PO-Revision-Date: 2018-08-03 12:34+0000\n" +"Last-Translator: Rodrigo Macedo \n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/" +"teams/23907/pt_BR/)\n" +"Language: pt_BR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.1.1\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "Exibir Nome" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "Identificação" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "Última Modificação em" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "Back-end da fita do ambiente da Web" diff --git a/web_environment_ribbon/i18n/sl.po b/web_environment_ribbon/i18n/sl.po new file mode 100644 index 00000000..3790712d --- /dev/null +++ b/web_environment_ribbon/i18n/sl.po @@ -0,0 +1,40 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +# Translators: +# OCA Transbot , 2017 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2017-07-13 16:06+0000\n" +"PO-Revision-Date: 2017-07-13 16:06+0000\n" +"Last-Translator: OCA Transbot , 2017\n" +"Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n" +"%100==4 ? 2 : 3);\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "" diff --git a/web_environment_ribbon/i18n/zh_CN.po b/web_environment_ribbon/i18n/zh_CN.po new file mode 100644 index 00000000..696dbc31 --- /dev/null +++ b/web_environment_ribbon/i18n/zh_CN.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_environment_ribbon +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-09-01 12:52+0000\n" +"Last-Translator: 黎伟杰 <674416404@qq.com>\n" +"Language-Team: none\n" +"Language: zh_CN\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 3.8\n" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__display_name +msgid "Display Name" +msgstr "显示名称" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend__id +msgid "ID" +msgstr "ID" + +#. module: web_environment_ribbon +#: model:ir.model.fields,field_description:web_environment_ribbon.field_web_environment_ribbon_backend____last_update +msgid "Last Modified on" +msgstr "最后修改时间" + +#. module: web_environment_ribbon +#: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend +msgid "Web Environment Ribbon Backend" +msgstr "Web环境标识后台" diff --git a/web_environment_ribbon/models/__init__.py b/web_environment_ribbon/models/__init__.py new file mode 100644 index 00000000..18368b47 --- /dev/null +++ b/web_environment_ribbon/models/__init__.py @@ -0,0 +1 @@ +from . import web_environment_ribbon_backend diff --git a/web_environment_ribbon/models/web_environment_ribbon_backend.py b/web_environment_ribbon/models/web_environment_ribbon_backend.py new file mode 100644 index 00000000..5932d7b3 --- /dev/null +++ b/web_environment_ribbon/models/web_environment_ribbon_backend.py @@ -0,0 +1,36 @@ +# Copyright 2017 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, models + + +class WebEnvironmentRibbonBackend(models.AbstractModel): + + _name = "web.environment.ribbon.backend" + _description = "Web Environment Ribbon Backend" + + @api.model + def _prepare_ribbon_format_vals(self): + return {"db_name": self.env.cr.dbname} + + @api.model + def _prepare_ribbon_name(self): + name_tmpl = self.env["ir.config_parameter"].sudo().get_param("ribbon.name") + vals = self._prepare_ribbon_format_vals() + return name_tmpl and name_tmpl.format(**vals) or name_tmpl + + @api.model + def get_environment_ribbon(self): + """ + This method returns the ribbon data from ir config parameters + :return: dictionary + """ + ir_config_model = self.env["ir.config_parameter"] + name = self._prepare_ribbon_name() + return { + "name": name, + "color": ir_config_model.sudo().get_param("ribbon.color"), + "background_color": ir_config_model.sudo().get_param( + "ribbon.background.color" + ), + } diff --git a/web_environment_ribbon/readme/CONFIGURE.rst b/web_environment_ribbon/readme/CONFIGURE.rst new file mode 100644 index 00000000..8542c72e --- /dev/null +++ b/web_environment_ribbon/readme/CONFIGURE.rst @@ -0,0 +1,8 @@ +* You can change the ribbon's name ("TEST") by editing the default system + parameter "ribbon.name" (in the menu Settings > Parameters > System + Parameters) To hide the ribbon, set this parameter to "False" or delete it. +* You can customize the ribbon color and background color through system + parameters: "ribbon.color", "ribbon.background.color". Fill with valid CSS + colors or just set to "False" to use default values. +* You can add the database name in the ribbon by adding "{db_name}" in the + system parameter "ribbon.name". diff --git a/web_environment_ribbon/readme/CONTRIBUTORS.rst b/web_environment_ribbon/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..257e450d --- /dev/null +++ b/web_environment_ribbon/readme/CONTRIBUTORS.rst @@ -0,0 +1,7 @@ +* Francesco Apruzzese +* Javi Melendez +* Antonio Espinosa +* Thomas Binsfeld +* Xavier Jiménez +* Dennis Sluijk +* Eric Lembregts diff --git a/web_environment_ribbon/readme/DESCRIPTION.rst b/web_environment_ribbon/readme/DESCRIPTION.rst new file mode 100644 index 00000000..c52ab9b5 --- /dev/null +++ b/web_environment_ribbon/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +Mark a Test Environment with a red ribbon on the top left corner in every page diff --git a/web_environment_ribbon/readme/USAGE.rst b/web_environment_ribbon/readme/USAGE.rst new file mode 100644 index 00000000..408d88cd --- /dev/null +++ b/web_environment_ribbon/readme/USAGE.rst @@ -0,0 +1,2 @@ +To use this module, you need only to install it. After installation, a red +ribbon will be visible on top left corner of every Odoo backend page diff --git a/web_environment_ribbon/static/description/icon.png b/web_environment_ribbon/static/description/icon.png new file mode 100644 index 00000000..78b52ae9 Binary files /dev/null and b/web_environment_ribbon/static/description/icon.png differ diff --git a/web_environment_ribbon/static/description/index.html b/web_environment_ribbon/static/description/index.html new file mode 100644 index 00000000..19706019 --- /dev/null +++ b/web_environment_ribbon/static/description/index.html @@ -0,0 +1,446 @@ + + + + + + +Web Environment Ribbon + + + +
+

Web Environment Ribbon

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runbot

+

Mark a Test Environment with a red ribbon on the top left corner in every page

+

Table of contents

+ +
+

Configuration

+
    +
  • You can change the ribbon’s name (“TEST”) by editing the default system +parameter “ribbon.name” (in the menu Settings > Parameters > System +Parameters) To hide the ribbon, set this parameter to “False” or delete it.
  • +
  • You can customize the ribbon color and background color through system +parameters: “ribbon.color”, “ribbon.background.color”. Fill with valid CSS +colors or just set to “False” to use default values.
  • +
  • You can add the database name in the ribbon by adding “{db_name}” in the +system parameter “ribbon.name”.
  • +
+
+
+

Usage

+

To use this module, you need only to install it. After installation, a red +ribbon will be visible on top left corner of every Odoo backend page

+
+
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us smashing it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Francesco OpenCode Apruzzese
  • +
  • Tecnativa
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_environment_ribbon/static/description/screenshot.png b/web_environment_ribbon/static/description/screenshot.png new file mode 100644 index 00000000..30245656 Binary files /dev/null and b/web_environment_ribbon/static/description/screenshot.png differ diff --git a/web_environment_ribbon/static/src/css/ribbon.css b/web_environment_ribbon/static/src/css/ribbon.css new file mode 100644 index 00000000..cbf4a40d --- /dev/null +++ b/web_environment_ribbon/static/src/css/ribbon.css @@ -0,0 +1,36 @@ +/* Copyright 2015 Francesco OpenCode Apruzzese + Copyright 2017 Thomas Binsfeld + Copyright 2021 Andreas Perhab + * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +.test-ribbon { + width: 300px; + top: 25px; + left: -100px; + text-align: center; + padding: 10px; + line-height: 20px; + letter-spacing: 1px; + color: #f0f0f0; + -webkit-transform: rotate(-45deg); + -ms-transform: rotate(-45deg); + -moz-transform: rotate(-45deg); + -o-transform: rotate(-45deg); + transform: rotate(-45deg); + z-index: 9999; + position: fixed; + box-shadow: 0 0 3px rgba(0, 0, 0, 0.3); + background: rgba(255, 0, 0, 0.6); + pointer-events: none; +} + +.test-ribbon b { + font-size: 20px; +} + +header:hover ~ .test-ribbon, +nav:hover ~ .test-ribbon { + /* Ease out ribbon when user is using the navigation in Odoo */ + opacity: 0; + transition: 0.2s ease; +} diff --git a/web_environment_ribbon/static/src/js/ribbon.js b/web_environment_ribbon/static/src/js/ribbon.js new file mode 100644 index 00000000..67a45712 --- /dev/null +++ b/web_environment_ribbon/static/src/js/ribbon.js @@ -0,0 +1,62 @@ +/* Copyright 2015 Sylvain Calador + Copyright 2015 Javi Melendez + Copyright 2016 Antonio Espinosa + Copyright 2017 Thomas Binsfeld + Copyright 2017 Xavier Jiménez + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ + +odoo.define("web_environment_ribbon.ribbon", function (require) { + "use strict"; + var rpc = require("web.rpc"); + var core = require("web.core"); + + // Code from: http://jsfiddle.net/WK_of_Angmar/xgA5C/ + function validStrColour(strToTest) { + if (strToTest === "") { + return false; + } + if (strToTest === "inherit") { + return true; + } + if (strToTest === "transparent") { + return true; + } + var image = document.createElement("img"); + image.style.color = "rgb(0, 0, 0)"; + image.style.color = strToTest; + if (image.style.color !== "rgb(0, 0, 0)") { + return true; + } + image.style.color = "rgb(255, 255, 255)"; + image.style.color = strToTest; + return image.style.color !== "rgb(255, 255, 255)"; + } + + core.bus.on("web_client_ready", null, function () { + var ribbon = $('