Skip to content

Commit

Permalink
Merge branch '12.0' of github.com:it-projects-llc/misc-addons into 12…
Browse files Browse the repository at this point in the history
….0-web_website-test_issue
  • Loading branch information
KolushovAlexandr committed Dec 4, 2018
2 parents cb4589d + 3d496f3 commit 6724b0b
Show file tree
Hide file tree
Showing 28 changed files with 85 additions and 359 deletions.
2 changes: 1 addition & 1 deletion ir_attachment_url/models/ir_http.py
Expand Up @@ -88,7 +88,7 @@ def binary_content(cls, xmlid=None, model='ir.attachment', id=None, field='datas
status = 301
content = module_resource_path
else:
# begin redefined part of original binary_content of odoo/base/addons/ir/ir_http
# begin redefined part of original binary_content of odoo/base/addons/models/ir_http
is_attachment = env[model]._fields[field].attachment
if is_attachment:
domain = [
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
@@ -1,2 +1,3 @@
icalendar
boto3
websocket-client
4 changes: 2 additions & 2 deletions res_users_signature/res_users_signature_models.py
Expand Up @@ -21,7 +21,7 @@
import re
import base64

from openerp.addons.base.ir.ir_mail_server import encode_rfc2822_address_header, encode_header, encode_header_param
from openerp.addons.base.models.ir_mail_server import encode_rfc2822_address_header, encode_header, encode_header_param


class ResUsers(models.Model):
Expand Down Expand Up @@ -112,7 +112,7 @@ class IrMailServer(models.Model):
def build_email(self, email_from, email_to, subject, body, email_cc=None, email_bcc=None, reply_to=False,
attachments=None, message_id=None, references=None, object_id=False, subtype='plain', headers=None,
body_alternative=None, subtype_alternative='plain'):
""" copy-pasted from openerp/addons/base/ir/ir_mail_server.py::build_email """
""" copy-pasted from openerp/addons/base/models/ir_mail_server.py::build_email """

ftemplate = '__image-%s__'
fcounter = 0
Expand Down
89 changes: 0 additions & 89 deletions sms_sg/i18n/es_CR.po

This file was deleted.

89 changes: 0 additions & 89 deletions sms_sg/i18n/fr.po

This file was deleted.

2 changes: 1 addition & 1 deletion theme_kit/models/theme.py
Expand Up @@ -3,7 +3,7 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import models, fields, api
from odoo.addons.base.ir.ir_qweb.assetsbundle import AssetsBundle, LessStylesheetAsset
from odoo.addons.base.models.assetsbundle import AssetsBundle, LessStylesheetAsset


class Theme(models.Model):
Expand Down
16 changes: 8 additions & 8 deletions web_debranding/README.rst
Expand Up @@ -8,10 +8,7 @@

Removes references to odoo.com:

1. Deletes Odoo label in footer, i.e.

Powered by Odoo

1. *(feature is not required in 12.0+ versions)*
2. Replaces "Odoo" in page title
3. Replaces "Odoo" in help message for empty list.

Expand Down Expand Up @@ -50,9 +47,11 @@ Removes references to odoo.com:
18. Hides Enterprise features in Settings
19. Replaces "Odoo" in all backend qweb templates

This provides a big part of debranding. You can find examples at menu ``[[ Invoicing ]] >> Dashboard >> Reconcile 5 items >> 'Automatic reconcilation' button title on hover``
This provides a big part of debranding. You can find examples in any tree view if you click ``[Import]`` button (e.g. at menu ``[[ Settings ]] >> Users & Companies >> Users``), then paste next code in browser javascript console:
``$('.oe_import_with_file').removeClass('d-none').siblings('.o_view_nocontent').hide().parent().find('.oe_import_noheaders.text-muted').show()``

If the file contains the column names, **Odoo** can try auto-detecting the field corresponding to the column. This makes imports simpler especially when the file has many columns.

Let **odoo** try to reconcile entries for the user

20. Replaces "odoo.com" in hints, examples, etc.

Expand Down Expand Up @@ -102,8 +101,9 @@ Further debranding
* delete or modify <title> tag
* delete or modify favicon
* delete or modify <img> tag with logo2.png
* delete or modify paragraph <p>Odoo is up and running! <br /> ...</p>
* delete or modify warning <div class="alert alert-warning">Warning, your Odoo database ...</div>
* delete or modify <small class="text-muted">To enhance your experience, some data may be sent to Odoo online services. See our <a href="https://www.odoo.com/privacy">Privacy Policy</a>.</small>
* delete or modify <p class="form-text">In order to avoid conflicts between databases, Odoo needs ...</p>

Auto-debrand new databases
==========================
Expand All @@ -118,7 +118,7 @@ To automatically install this module for every new databases set **'auto_install
* base_setup (built-in)
* bus (built-in)

Tested on Odoo 12.0 edd8bad5d97ee489e85504791c807f0099ef24b5
Tested on Odoo 12.0 e774b2cb1c29fdd407aedc1f5c959d9725d2b514

Enterprise users notice
=======================
Expand Down
2 changes: 1 addition & 1 deletion web_debranding/__manifest__.py
Expand Up @@ -32,5 +32,5 @@
"post_load": 'post_load',
'auto_install': False,
'uninstall_hook': 'uninstall_hook',
'installable': False
'installable': True
}
4 changes: 4 additions & 0 deletions web_debranding/data.xml
Expand Up @@ -10,4 +10,8 @@
<record id="base.main_partner" model="res.partner">
<field name="image"></field>
</record>
<record id="base.partner_root" model="res.partner">
<field name="name">Bot</field>
<field name="email">bot@example.com</field>
</record>
</odoo>
16 changes: 16 additions & 0 deletions web_debranding/models/mail_channel.py
@@ -0,0 +1,16 @@
# Copyright 2018 Bikbov Rafis <https://it-projects.info/team/bikbov>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import models, api


class Channel(models.Model):
_inherit = 'mail.channel'

@api.model
def init_odoobot(self):
channel = super(Channel, self).init_odoobot()
channel.write({
'name': 'Bot'
})
return channel
4 changes: 3 additions & 1 deletion web_debranding/models/res_users.py
@@ -1,12 +1,14 @@
# Copyright 2018 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

from odoo import models, api
from odoo import models, api, fields


class ResUsers(models.Model):
_inherit = 'res.users'

odoobot_state = fields.Selection(string="Bot Status")

@api.multi
def is_admin(self):
# By default Python functions starting with _ are considered private methods.
Expand Down
6 changes: 2 additions & 4 deletions web_debranding/static/src/js/bot.js
Expand Up @@ -14,13 +14,11 @@ odoo.define('web_debranding.bot', function (require) {
}
return this._super.apply(this, arguments);
},

getAvatarSource: function () {
var res = this._super.apply(this, arguments);
if (res === '/mail/static/src/img/odoo_o.png') {
if (this._isOdoobotAuthor()) {
return '/web/binary/company_logo?company_id=' + session.company_id;
}
return res;
return this._super.apply(this, arguments);
}
});
});
55 changes: 29 additions & 26 deletions web_debranding/static/src/js/native_notifications.js
Expand Up @@ -6,36 +6,39 @@ odoo.define('web_debranding.native_notifications', function (require) {

require('web_debranding.base');
var session = require('web.session');
var BusService = require('bus.BusService');
var core = require('web.core');
var utils = require('mail.utils');
var bus = require('bus.bus').bus;

var _t = core._t;

var _send_native_notification = function (title, content) {
var notification = new Notification(title, {body: content, icon: '/web/binary/company_logo?company_id=' + session.company_id});
notification.onclick = function () {
window.focus();
if (this.cancel) {
this.cancel();
} else if (this.close) {
this.close();
BusService.include({
sendNotification: function (title, content, callback) {
if (title === _t('Yay, push notifications are enabled!') || title === _t('Permission denied')) {
content = content.replace(/Odoo/ig, odoo.debranding_new_name);
}
};
};

var send_notification_super = utils.send_notification;
utils.send_notification = function (widget, title, content) {
if (title === 'Permission granted' || title === 'Permission denied') {
content = content.replace(/Odoo/ig, odoo.debranding_new_name);
}
if (Notification && Notification.permission === "granted") {
if (bus.is_master) {
_send_native_notification(title, content);
if (window.Notification && Notification.permission === "granted") {
if (BusService.isMasterTab()) {
this._sendNativeNotification(title, content, callback);
}
} else {
this._super(title, content, callback);
}
} else {
send_notification_super(widget, title, content);
}
};
},
_sendNativeNotification: function (title, content, callback) {
var notification = new Notification(title, {body: content, icon: '/web/binary/company_logo?company_id=' + session.company_id});
notification.onclick = function () {
window.focus();
if (this.cancel) {
this.cancel();
} else if (this.close) {
this.close();
}
if (callback) {
// eslint-disable-next-line
callback();
}
};
},
});

return BusService;
});

0 comments on commit 6724b0b

Please sign in to comment.