diff --git a/web_company_background_color/README.rst b/web_company_background_color/README.rst new file mode 100644 index 00000000..8d1b78d2 --- /dev/null +++ b/web_company_background_color/README.rst @@ -0,0 +1,81 @@ +============================ +Web Company Background Color +============================ + +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! 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/11.0/web_company_background_color + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-11-0/web-11-0-web_company_background_color + :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/11.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module allows you to change the color of the navigation bar +depending on the company you are logged into. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Go to *Settings / Users & Companies* and select the company. +In the field 'Background color' select the background of your choice. + +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 +~~~~~~~ + +* Eficent + +Contributors +~~~~~~~~~~~~ + +* Jordi Ballester Alomar (Eficent) +* Lois Rilo (Eficent) + +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_company_background_color/__init__.py b/web_company_background_color/__init__.py new file mode 100644 index 00000000..0650744f --- /dev/null +++ b/web_company_background_color/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/web_company_background_color/__manifest__.py b/web_company_background_color/__manifest__.py new file mode 100644 index 00000000..98d7d26d --- /dev/null +++ b/web_company_background_color/__manifest__.py @@ -0,0 +1,22 @@ +# Copyright 2019 Eficent Business and IT Consulting Services, S.L. +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': "Web Company Background Color", + 'version': '11.0.1.0.0', + 'category': 'Web', + 'author': 'Eficent, ' + 'Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/web', + 'license': 'AGPL-3', + "depends": [ + 'web_widget_color', + ], + "data": [ + 'view/base_view.xml', + 'view/res_company_view.xml', + 'data/company_data.xml', + ], + "auto_install": False, + 'installable': True +} diff --git a/web_company_background_color/data/company_data.xml b/web_company_background_color/data/company_data.xml new file mode 100644 index 00000000..8146a851 --- /dev/null +++ b/web_company_background_color/data/company_data.xml @@ -0,0 +1,6 @@ + + + + + diff --git a/web_company_background_color/models/__init__.py b/web_company_background_color/models/__init__.py new file mode 100644 index 00000000..1239738c --- /dev/null +++ b/web_company_background_color/models/__init__.py @@ -0,0 +1,2 @@ +from . import res_company + diff --git a/web_company_background_color/models/res_company.py b/web_company_background_color/models/res_company.py new file mode 100644 index 00000000..186d8782 --- /dev/null +++ b/web_company_background_color/models/res_company.py @@ -0,0 +1,15 @@ +# Copyright 2017 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class ResCompany(models.Model): + + _inherit = 'res.company' + + background_color = fields.Char() + + @api.model + def get_background_color(self): + return self.env.user.company_id.background_color diff --git a/web_company_background_color/readme/CONFIGURE.rst b/web_company_background_color/readme/CONFIGURE.rst new file mode 100644 index 00000000..3acc2de9 --- /dev/null +++ b/web_company_background_color/readme/CONFIGURE.rst @@ -0,0 +1,2 @@ +Go to *Settings / Users & Companies* and select the company. +In the field 'Background color' select the background of your choice. diff --git a/web_company_background_color/readme/CONTRIBUTORS.rst b/web_company_background_color/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000..5f74f86e --- /dev/null +++ b/web_company_background_color/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Jordi Ballester Alomar (Eficent) +* Lois Rilo (Eficent) diff --git a/web_company_background_color/readme/DESCRIPTION.rst b/web_company_background_color/readme/DESCRIPTION.rst new file mode 100644 index 00000000..a93c90f5 --- /dev/null +++ b/web_company_background_color/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module allows you to change the color of the navigation bar +depending on the company you are logged into. \ No newline at end of file diff --git a/web_company_background_color/static/description/icon.png b/web_company_background_color/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_company_background_color/static/description/icon.png differ diff --git a/web_company_background_color/static/description/index.html b/web_company_background_color/static/description/index.html new file mode 100644 index 00000000..80a7ad7e --- /dev/null +++ b/web_company_background_color/static/description/index.html @@ -0,0 +1,405 @@ + + + + + + +Web Company Background Color + + + +
+

Web Company Background Color

+ + +

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

+

This module allows you to change the color of the navigation bar +depending on the company you are logged into.

+

Table of contents

+ +
+

Configuration

+

Go to Settings / Users & Companies and select the company. +In the field ‘Background color’ select the background of your choice.

+
+
+

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

+
    +
  • Eficent
  • +
+
+
+

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_company_background_color/static/src/js/company_background_color.js b/web_company_background_color/static/src/js/company_background_color.js new file mode 100644 index 00000000..0a24a611 --- /dev/null +++ b/web_company_background_color/static/src/js/company_background_color.js @@ -0,0 +1,42 @@ +/* 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_company_background_color.background_color', function(require) { +"use strict"; + + var $ = require('jquery'); + var rpc = require('web.rpc'); + var core = require('web.core'); + + core.bus.on('web_client_ready', null, function () { + // Get company background color from backend + rpc.query({ + model: 'res.company', + method: 'get_background_color', + }).then( + function (background_color) { + if (background_color) { + // Compatibiliy with Odoo Community + var el = $('body').find('[class="navbar navbar-inverse"]') + el.css('background-color', background_color) + el.css('border-left-color', background_color) + el.css('border-right-color', background_color) + el.css('border-top-color', background_color) + el.css('border-bottom-color', background_color) + el.css('color', background_color) + var el = $('body').find('[class="navbar-collapse collapse"]') + el.find('[class="oe_menu_toggler"]').css('background-color', background_color) + el.find('[class="dropdown-toggle"]').css('background-color', background_color) + // Compatibiliy with Odoo Enterprise + $('body').find('[class="o_main_navbar"]').css('background-color', background_color) + // Compatibiliy with OCA web_responsive + $('body').find('[class="navbar navbar-default main-nav"]').css('background-color', background_color) + } + } + ); + }); +}); diff --git a/web_company_background_color/view/base_view.xml b/web_company_background_color/view/base_view.xml new file mode 100644 index 00000000..19b8e253 --- /dev/null +++ b/web_company_background_color/view/base_view.xml @@ -0,0 +1,16 @@ + + + + + +