Skip to content

Commit

Permalink
Merge branch '12.0' into 12.0-web_debranding-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruzilia Mukhutdinova committed Aug 6, 2019
2 parents 809d58c + de9408d commit 4f203bb
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 3 deletions.
3 changes: 2 additions & 1 deletion web_debranding/__manifest__.py
Expand Up @@ -3,10 +3,11 @@
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2018 WohthaN <https://github.com/WohthaN>
# Copyright 2019 Eugene Molotov <https://github.com/em230418>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
{
'name': "Backend debranding",
'version': '12.0.1.0.27',
'version': '12.0.1.0.28',
'author': 'IT-Projects LLC, Ivan Yelizariev',
'license': 'LGPL-3',
'category': 'Debranding',
Expand Down
7 changes: 7 additions & 0 deletions web_debranding/doc/changelog.rst
@@ -1,3 +1,10 @@
`1.0.28`
--------

**Fix:** debrand_bytes now accepts bytes and str types
**Fix:** fixed "OdooBot has a request" item in notifications
**Fix:** included mail_channel fixes

`1.0.27`
--------

Expand Down
1 change: 0 additions & 1 deletion web_debranding/doc/index.rst
Expand Up @@ -96,4 +96,3 @@ RESULT: No more Odoo word in hints, examples, etc. *There is a placeholder for f
* Send ``/help`` to the chat

RESULT: The message from the Bot open menu has been received.

1 change: 1 addition & 0 deletions web_debranding/models/__init__.py
Expand Up @@ -6,4 +6,5 @@
from . import ir_config_parameter
from . import ir_ui_view
from . import mail_message
from . import mail_channel
from . import res_users
1 change: 1 addition & 0 deletions web_debranding/models/ir_config_parameter.py
Expand Up @@ -3,6 +3,7 @@
# Copyright 2017 ArtyomLosev <https://github.com/ArtyomLosev>
# Copyright 2017 Ilmir Karamov <https://it-projects.info/team/ilmir-k>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2019 Eugene Molotov <https://github.com/em230418>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import models, api
Expand Down
5 changes: 4 additions & 1 deletion web_debranding/models/ir_translation.py
Expand Up @@ -4,6 +4,7 @@
# Copyright 2017 Nicolas JEUDY <https://github.com/njeudy>
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# Copyright 2018 Ildar Nasyrov <https://it-projects.info/team/iledarn>
# Copyright 2019 Eugene Molotov <https://it-projects.info/team/molotov>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

import re
Expand Down Expand Up @@ -57,7 +58,9 @@ def debrand(env, source, is_code=False):


def debrand_bytes(env, source):
return bytes(debrand(env, source.decode('utf-8')), 'utf-8')
if type(source) is bytes:
source = source.decode('utf-8')
return bytes(debrand(env, source), 'utf-8')


class IrTranslation(models.Model):
Expand Down
20 changes: 20 additions & 0 deletions web_debranding/static/src/js/bot.js
Expand Up @@ -6,6 +6,9 @@ odoo.define('web_debranding.bot', function (require) {
require('web_debranding.dialog');
var Message = require('mail.model.Message');
var session = require('web.session');
var MailBotService = require('mail_bot.MailBotService');
var core = require('web.core');
var _t = core._t;

Message.include({
_getAuthorName: function () {
Expand All @@ -21,4 +24,21 @@ odoo.define('web_debranding.bot', function (require) {
return this._super.apply(this, arguments);
}
});

MailBotService.include({
getPreviews: function (filter) {
var previews = this._super.apply(this, arguments);
previews.map(function(preview) {
if (preview.title == _t("OdooBot has a request")) {
preview.title = _t("Bot has a request");
}
if (preview.imageSRC == "/mail/static/src/img/odoobot.png") {
preview.imageSRC = '/web/binary/company_logo?company_id=' + session.company_id;
}
return preview;
});
return previews;
},
});

});
1 change: 1 addition & 0 deletions web_debranding/tests/__init__.py
@@ -1,3 +1,4 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from . import test_developer_mode_menu_elements
from . import test_misc
17 changes: 17 additions & 0 deletions web_debranding/tests/test_misc.py
@@ -0,0 +1,17 @@
# Copyright 2019 Eugene Molotov <https://github.com/em230418>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

import odoo.tests
from ..models.ir_translation import debrand_bytes


@odoo.tests.common.tagged('at_install', 'post_install')
class TestMisc(odoo.tests.TransactionCase):

def test_debrand_bytes(self):
env = self.env
env['ir.config_parameter'].sudo().set_param("web_debranding.new_name", "SuperName")
assert debrand_bytes(env, b'odoo') == b'SuperName'
assert debrand_bytes(env, 'odoo') == b'SuperName'
assert debrand_bytes(env, b'test') == b'test'
assert debrand_bytes(env, 'test') == b'test'

0 comments on commit 4f203bb

Please sign in to comment.