diff --git a/web_company_title/__init__.py b/web_company_title/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/web_company_title/__manifest__.py b/web_company_title/__manifest__.py new file mode 100644 index 000000000..7fcb1ce8c --- /dev/null +++ b/web_company_title/__manifest__.py @@ -0,0 +1,18 @@ +# Odoo, Open Source Web Company Title +# Copyright (C) 2019 Alexandre Díaz +# +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).# +{ + 'name': "Web Company Title", + 'category': "web", + 'version': "11.0.1.0.0", + "author": "Alexandre Díaz, " + "Odoo Community Association (OCA)", + 'depends': ['web'], + 'data': [ + 'views/assets.xml', + ], + 'license': 'AGPL-3', + 'auto_install': False, + 'installable': True, +} diff --git a/web_company_title/readme/DESCRIPTION.rst b/web_company_title/readme/DESCRIPTION.rst new file mode 100644 index 000000000..fe916ea79 --- /dev/null +++ b/web_company_title/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module show the company name in the browser title-bar. diff --git a/web_company_title/static/src/js/web_company_title.js b/web_company_title/static/src/js/web_company_title.js new file mode 100644 index 000000000..5c891b93d --- /dev/null +++ b/web_company_title/static/src/js/web_company_title.js @@ -0,0 +1,21 @@ +/* Copyright 2019 Alexandre Díaz + License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). */ +odoo.define('web_company_title.TitleChanger', function (require) { + "use strict"; + + var rpc = require('web.rpc'); + var core = require('web.core'); + var session = require('web.session'); + var web_client = require('web.web_client'); + + core.bus.on('web_client_ready', null, function () { + rpc.query({ + model: 'res.company', + method: 'search_read', + args: [[['id', '=', session.company_id]], ['name']], + }).then(function (companies) { + web_client.set_title_part('company', companies[0].name); + }); + }); + +}); diff --git a/web_company_title/views/assets.xml b/web_company_title/views/assets.xml new file mode 100644 index 000000000..5e4d26a9e --- /dev/null +++ b/web_company_title/views/assets.xml @@ -0,0 +1,8 @@ + + + +