odoo config addons_path for enterprise and 3rd party addons
removed duplicate module web_environment_ribbon favicon can now be set with the setup scriptdevelop
							parent
							
								
									92a4034032
								
							
						
					
					
						commit
						aeee2e58b8
					
				|  | @ -8,7 +8,9 @@ db_port = 5432 | |||
| db_user = False | ||||
| db_password = False | ||||
| 
 | ||||
| addons_path = ext/odoo/addons,ext/custom-addons,dmi/run1 | ||||
| addons_path = ext/odoo/addons,ext/3rd-party-addons,ext/custom-addons,dmi/run1 | ||||
| ; For enterprise use the addons path bellow | ||||
| ; addons_path = ext/enterprise-addons,ext/odoo/addons,ext/3rd-party-addons,ext/custom-addons,dmi/run1 | ||||
| timezone = Europe/Vienna | ||||
| 
 | ||||
| #dbfilter_test = ['.*',] | ||||
|  |  | |||
|  | @ -1,73 +0,0 @@ | |||
| .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||||
|    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||||
|    :alt: License: AGPL-3 | ||||
| 
 | ||||
| ====================== | ||||
| Web Environment Ribbon | ||||
| ====================== | ||||
| 
 | ||||
| Mark a Test Environment with a red ribbon on the top left corner in every page | ||||
| 
 | ||||
| .. image:: /web_environment_ribbon/static/description/screenshot.png | ||||
|     :alt: Screenshot | ||||
| 
 | ||||
| Installation | ||||
| ============ | ||||
| 
 | ||||
| No special setup | ||||
| 
 | ||||
| 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 | ||||
| 
 | ||||
| .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||||
|    :alt: Try me on Runbot | ||||
|    :target: https://runbot.odoo-community.org/runbot/162/10.0 | ||||
| 
 | ||||
| Bug Tracker | ||||
| =========== | ||||
| 
 | ||||
| Bugs are tracked on `GitHub Issues | ||||
| <https://github.com/OCA/web/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. | ||||
| 
 | ||||
| Credits | ||||
| ======= | ||||
| 
 | ||||
| Contributors | ||||
| ------------ | ||||
| 
 | ||||
| * Francesco Apruzzese <cescoap@gmail.com> | ||||
| * Javi Melendez <javimelex@gmail.com> | ||||
| * Antonio Espinosa <antonio.espinosa@tecnativa.com> | ||||
| * Thomas Binsfeld <thomas.binsfeld@acsone.eu> | ||||
| 
 | ||||
| Maintainer | ||||
| ---------- | ||||
| 
 | ||||
| .. image:: https://odoo-community.org/logo.png | ||||
|    :alt: Odoo Community Association | ||||
|    :target: https://odoo-community.org | ||||
| 
 | ||||
| This module is maintained by the OCA. | ||||
| 
 | ||||
| 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. | ||||
| 
 | ||||
| To contribute to this module, please visit https://odoo-community.org. | ||||
|  | @ -1,6 +0,0 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com> | ||||
| # Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> | ||||
| # Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu> | ||||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||||
| from . import models | ||||
|  | @ -1,27 +0,0 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com> | ||||
| # Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> | ||||
| # Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu> | ||||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||||
| 
 | ||||
| { | ||||
|     'name': "Web Environment Ribbon", | ||||
|     'version': '10.0.1.0.0', | ||||
|     'category': 'Web', | ||||
|     'author': 'Francesco OpenCode Apruzzese, ' | ||||
|               'Tecnativa, ' | ||||
|               'Odoo Community Association (OCA)', | ||||
|     'website': 'https://it.linkedin.com/in/francescoapruzzese', | ||||
|     'license': 'AGPL-3', | ||||
|     "depends": [ | ||||
|         'web', | ||||
|         ], | ||||
|     "data": [ | ||||
|         'view/base_view.xml', | ||||
|         'data/ribbon_data.xml', | ||||
|         ], | ||||
|     "update_xml": [], | ||||
|     "demo_xml": [], | ||||
|     "auto_install": False, | ||||
|     'installable': True | ||||
| } | ||||
|  | @ -1,24 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!-- Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com> | ||||
|      License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||||
| <odoo noupdate="1"> | ||||
| 
 | ||||
| <!-- Add ribbon name default configuration parameter --> | ||||
| <record id="default_ribbon_name" model="ir.config_parameter"> | ||||
|     <field name="key">ribbon.name</field> | ||||
|     <field name="value"><![CDATA[TEST<br/>({db_name})]]></field> | ||||
| </record> | ||||
| 
 | ||||
| <!-- Add ribbon color configuration parameter --> | ||||
| <record id="set_ribbon_color" model="ir.config_parameter"> | ||||
|     <field name="key">ribbon.color</field> | ||||
|     <field name="value">#f0f0f0</field> | ||||
| </record> | ||||
| 
 | ||||
| <!-- Add ribbon background color configuration parameter --> | ||||
| <record id="set_ribbon_background_color" model="ir.config_parameter"> | ||||
|     <field name="key">ribbon.background.color</field> | ||||
|     <field name="value">rgba(255,0,0,.6)</field> | ||||
| </record> | ||||
| 
 | ||||
| </odoo> | ||||
|  | @ -1,39 +0,0 @@ | |||
| # Translation of Odoo Server. | ||||
| # This file contains the translation of the following modules: | ||||
| # * web_environment_ribbon | ||||
| #  | ||||
| # Translators: | ||||
| # Niki Waibel <niki.waibel@gmail.com>, 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: Niki Waibel <niki.waibel@gmail.com>, 2017\n" | ||||
| "Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" | ||||
| "MIME-Version: 1.0\n" | ||||
| "Content-Type: text/plain; charset=UTF-8\n" | ||||
| "Content-Transfer-Encoding: \n" | ||||
| "Language: de\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 "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 "" | ||||
| 
 | ||||
| #. module: web_environment_ribbon | ||||
| #: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend | ||||
| msgid "Web Environment Ribbon Backend" | ||||
| msgstr "" | ||||
|  | @ -1,40 +0,0 @@ | |||
| # Translation of Odoo Server. | ||||
| # This file contains the translation of the following modules: | ||||
| # * web_environment_ribbon | ||||
| #  | ||||
| # Translators: | ||||
| # OCA Transbot <transbot@odoo-community.org>, 2017 | ||||
| # Quentin THEURET <odoo@kerpeo.com>, 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 <odoo@kerpeo.com>, 2017\n" | ||||
| "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" | ||||
| "MIME-Version: 1.0\n" | ||||
| "Content-Type: text/plain; charset=UTF-8\n" | ||||
| "Content-Transfer-Encoding: \n" | ||||
| "Language: fr\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" | ||||
|  | @ -1,39 +0,0 @@ | |||
| # Translation of Odoo Server. | ||||
| # This file contains the translation of the following modules: | ||||
| # * web_environment_ribbon | ||||
| #  | ||||
| # Translators: | ||||
| # Bole <bole@dajmi5.com>, 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 <bole@dajmi5.com>, 2017\n" | ||||
| "Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n" | ||||
| "MIME-Version: 1.0\n" | ||||
| "Content-Type: text/plain; charset=UTF-8\n" | ||||
| "Content-Transfer-Encoding: \n" | ||||
| "Language: hr\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 "" | ||||
|  | @ -1,39 +0,0 @@ | |||
| # Translation of Odoo Server. | ||||
| # This file contains the translation of the following modules: | ||||
| # * web_environment_ribbon | ||||
| #  | ||||
| # Translators: | ||||
| # Peter Hageman <hageman.p@gmail.com>, 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: Peter Hageman <hageman.p@gmail.com>, 2017\n" | ||||
| "Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/teams/23907/nl_NL/)\n" | ||||
| "MIME-Version: 1.0\n" | ||||
| "Content-Type: text/plain; charset=UTF-8\n" | ||||
| "Content-Transfer-Encoding: \n" | ||||
| "Language: nl_NL\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 "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 "" | ||||
| 
 | ||||
| #. module: web_environment_ribbon | ||||
| #: model:ir.model,name:web_environment_ribbon.model_web_environment_ribbon_backend | ||||
| msgid "Web Environment Ribbon Backend" | ||||
| msgstr "" | ||||
|  | @ -1,39 +0,0 @@ | |||
| # Translation of Odoo Server. | ||||
| # This file contains the translation of the following modules: | ||||
| # * web_environment_ribbon | ||||
| #  | ||||
| # Translators: | ||||
| # Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 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: Rodrigo de Almeida Sottomaior Macedo <rmsolucoeseminformatic4@gmail.com>, 2017\n" | ||||
| "Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n" | ||||
| "MIME-Version: 1.0\n" | ||||
| "Content-Type: text/plain; charset=UTF-8\n" | ||||
| "Content-Transfer-Encoding: \n" | ||||
| "Language: pt_BR\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 "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 "" | ||||
|  | @ -1,39 +0,0 @@ | |||
| # Translation of Odoo Server. | ||||
| # This file contains the translation of the following modules: | ||||
| # * web_environment_ribbon | ||||
| #  | ||||
| # Translators: | ||||
| # OCA Transbot <transbot@odoo-community.org>, 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 <transbot@odoo-community.org>, 2017\n" | ||||
| "Language-Team: Slovenian (https://www.transifex.com/oca/teams/23907/sl/)\n" | ||||
| "MIME-Version: 1.0\n" | ||||
| "Content-Type: text/plain; charset=UTF-8\n" | ||||
| "Content-Transfer-Encoding: \n" | ||||
| "Language: sl\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 "" | ||||
|  | @ -1 +0,0 @@ | |||
| from . import web_environment_ribbon_backend | ||||
|  | @ -1,38 +0,0 @@ | |||
| # -*- coding: utf-8 -*- | ||||
| # Copyright 2017 ACSONE SA/NV | ||||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||||
| 
 | ||||
| from openerp 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'].get_param('ribbon.name') | ||||
|         vals = self._prepare_ribbon_format_vals() | ||||
|         return name_tmpl.format(**vals) | ||||
| 
 | ||||
|     @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.get_param('ribbon.color'), | ||||
|             'background_color': ir_config_model.get_param( | ||||
|                 'ribbon.background.color'), | ||||
|         } | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 9.1 KiB | 
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 43 KiB | 
|  | @ -1,28 +0,0 @@ | |||
| /* Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com> | ||||
|    Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu> | ||||
|  * 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,.3); | ||||
|     background: rgba(255,0,0,.6); | ||||
|     pointer-events: none; | ||||
| } | ||||
| 
 | ||||
| .test-ribbon b { | ||||
|     font-size: 20px; | ||||
| } | ||||
|  | @ -1,54 +0,0 @@ | |||
| /* Copyright 2015 Sylvain Calador <sylvain.calador@akretion.com> | ||||
|    Copyright 2015 Javi Melendez <javi.melendez@algios.com> | ||||
|    Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> | ||||
|    Copyright 2017 Thomas Binsfeld <thomas.binsfeld@acsone.eu> | ||||
|  * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */
 | ||||
| 
 | ||||
| odoo.define('web_environment_ribbon.ribbon', function(require) { | ||||
| "use strict"; | ||||
| 
 | ||||
| var $ = require('jquery'); | ||||
| var Model = require('web.Model'); | ||||
| var core = require('web.core'); | ||||
| 
 | ||||
| var backend_model = new Model('web.environment.ribbon.backend'); | ||||
| 
 | ||||
| // 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 = $('<div class="test-ribbon"/>'); | ||||
|     $('body').append(ribbon); | ||||
|     ribbon.hide(); | ||||
|     // Get ribbon data from backend
 | ||||
|     backend_model.call('get_environment_ribbon').then( | ||||
|         function (ribbon_data) { | ||||
|             // Ribbon name
 | ||||
|             if (ribbon_data.name && ribbon_data.name != 'False') { | ||||
|                 ribbon.html(ribbon_data.name); | ||||
|                 ribbon.show(); | ||||
|             } | ||||
|             // Ribbon color
 | ||||
|             if (ribbon_data.color && validStrColour(ribbon_data.color)) { | ||||
|                 ribbon.css('color', ribbon_data.color); | ||||
|             } | ||||
|             // Ribbon background color
 | ||||
|             if (ribbon_data.background_color && validStrColour(ribbon_data.background_color)) { | ||||
|                 ribbon.css('background-color', ribbon_data.background_color); | ||||
|             } | ||||
|         } | ||||
|     ); | ||||
| }); | ||||
| 
 | ||||
| }); // odoo.define
 | ||||
|  | @ -1,18 +0,0 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <!-- Copyright 2015 Francesco OpenCode Apruzzese <cescoap@gmail.com> | ||||
|      Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com> | ||||
|      License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||||
| <odoo> | ||||
| 
 | ||||
| <!-- Load css for ribbons --> | ||||
| <template id="assets_backend" name="ribbon_test assets" | ||||
|           inherit_id="web.assets_backend"> | ||||
|     <xpath expr="." position="inside"> | ||||
|         <link rel="stylesheet" | ||||
|               href="/web_environment_ribbon/static/src/css/ribbon.css"/> | ||||
|         <script type="text/javascript" | ||||
|                 src="/web_environment_ribbon/static/src/js/ribbon.js"/> | ||||
|     </xpath> | ||||
| </template> | ||||
| 
 | ||||
| </odoo> | ||||
|  | @ -30,6 +30,8 @@ class Config(): | |||
|             'vat_check_vies': True, | ||||
|             'tax_calculation_rounding_method': 'round_globally', | ||||
|             'logo': '../ext/custom-addons/dp_custom/static/src/img/logo.png', | ||||
|             'favicon_backend': '../ext/custom-addons/dp_custom/static/src/img/favicon.ico', | ||||
|             'favicon_backend_mimetype': 'image/x-icon' | ||||
|         } | ||||
| 
 | ||||
|         self.mail_server = { | ||||
|  |  | |||
|  | @ -123,6 +123,9 @@ class DatenpolFunctions(): | |||
| 
 | ||||
|         if vals.get('logo', False): | ||||
|             vals['logo'] = self._readAndReturnFile(vals['logo'], encode='base64') | ||||
|         if vals.get('favicon_backend', False): | ||||
|             vals['favicon_backend'] = self._readAndReturnFile(vals['favicon_backend'], encode='base64') | ||||
| 
 | ||||
|         vals['country_id'] = country_id | ||||
|         c_ids = self._execute('res.company', 'search', []) | ||||
|         return self._execute('res.company', 'write', c_ids, vals) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue