Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
indent_style = space
indent_size = 2
tab_width = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
43 changes: 21 additions & 22 deletions backend_theme_v10/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,27 @@
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).

{
"name": "Material/United Backend Theme",
"summary": "Odoo 10.0 community backend theme",
"version": "10.0.1.0.23",
"category": "Themes/Backend",
"website": "http://www.openworx.nl",
"description": """
"name": "Material/United Backend Theme",
"summary": "Odoo 10.0 community backend theme",
"version": "10.0.1.0.23",
"category": "Themes/Backend",
"website": "http://www.openworx.nl",
"description": """
Backend theme for Odoo 10.0 community edition.
""",
'images':[
'images/screen.png'
],
"author": "Openworx",
"license": "LGPL-3",
"installable": True,
"depends": [
'web_responsive',
],
"data": [
'views/assets.xml',
'views/res_company_view.xml',
'views/users.xml',
'views/sidebar.xml',
],
'images': [
'images/screen.png'
],
"author": "Openworx",
"license": "LGPL-3",
"installable": True,
"depends": [
'web_responsive',
],
"data": [
'views/assets.xml',
'views/res_company_view.xml',
'views/users.xml',
'views/sidebar.xml',
],
}

2 changes: 1 addition & 1 deletion backend_theme_v10/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# -*- coding: utf-8 -*-
from . import main
from . import main
21 changes: 10 additions & 11 deletions backend_theme_v10/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
DEFAULT_IMAGE = '/backend_theme_v10/static/src/img/material-background.jpg'

class DasboardBackground(Controller):
@route(['/dashboard'], type='http', auth='user', website=False)
def dashboard(self, **post):
user = request.env.user
company = user.company_id
if company.dashboard_background:
image = base64.b64decode(company.dashboard_background)
else:
return redirect(DEFAULT_IMAGE)

@route(['/dashboard'], type='http', auth='user', website=False)
def dashboard(self, **post):
user = request.env.user
company = user.company_id
if company.dashboard_background:
image = base64.b64decode(company.dashboard_background)
else:
return redirect(DEFAULT_IMAGE)

return request.make_response(
image, [('Content-Type', 'image')])
return request.make_response(
image, [('Content-Type', 'image')])
5 changes: 2 additions & 3 deletions backend_theme_v10/models/res_company.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from odoo import models, fields

class ResCompany(models.Model):
_inherit = 'res.company'

_inherit = 'res.company'

dashboard_background = fields.Binary(attachment=True)
dashboard_background = fields.Binary(attachment=True)
31 changes: 15 additions & 16 deletions backend_theme_v10/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
from odoo import models, fields

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

_inherit = 'res.users'
sidebar_visible = fields.Boolean("Show App Sidebar", default=True)

sidebar_visible = fields.Boolean("Show App Sidebar", default=True)

def __init__(self, pool, cr):
""" Override of __init__ to add access rights on notification_email_send
and alias fields. Access rights are disabled by default, but allowed
on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
"""
init_res = super(ResUsers, self).__init__(pool, cr)
# duplicate list to avoid modifying the original reference
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
type(self).SELF_WRITEABLE_FIELDS.extend(['sidebar_visible'])
# duplicate list to avoid modifying the original reference
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
type(self).SELF_READABLE_FIELDS.extend(['sidebar_visible'])
return init_res
def __init__(self, pool, cr):
""" Override of __init__ to add access rights on notification_email_send
and alias fields. Access rights are disabled by default, but allowed
on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
"""
init_res = super(ResUsers, self).__init__(pool, cr)
# duplicate list to avoid modifying the original reference
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
type(self).SELF_WRITEABLE_FIELDS.extend(['sidebar_visible'])
# duplicate list to avoid modifying the original reference
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
type(self).SELF_READABLE_FIELDS.extend(['sidebar_visible'])
return init_res
76 changes: 38 additions & 38 deletions backend_theme_v10/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h1 class="oe_slogan" style="color:#337ab7;">Material/United Backend Theme</h1>
<h2 class="oe_slogan">The first Odoo 10.0 community backend theme</h2>
<div class="oe_screenshot" style="text-align: center;">
<h3 class="oe_slogan" style="color:#337ab7;">Enterprise like backend theme</h3>
<img style="max-width: 100%;" src="screen.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Sidebar App Dashboard. Enable/disable in User Preferences</h3>
<img style="max-width: 100%;" src="sidebar.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Project Dashboard</h3>
<img style="max-width: 100%;" src="project.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Contact form</h3>
<img style="max-width: 100%;" src="contact.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Change background</h3>
<img style="max-width: 100%;" src="settings.png"/><br><br>
</div>
</div>
</div>
</section>
<section class="oe_container oe_separator">
</section>
<section class="oe_container" style="background-color:#E8E8E8; padding:20px 0px 90px 0px">
<div class="oe_row">
<div class="oe_span12">
<div class="oe_centeralign">
<p>Remark: It is possible that the Odoo service needs to be restarted after install.</p>
</div>
</div>
</div>
</section>
<section class="oe_container oe_separator">
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h1 class="oe_slogan" style="color:#337ab7;">Material/United Backend Theme</h1>
<h2 class="oe_slogan">The first Odoo 10.0 community backend theme</h2>
<div class="oe_screenshot" style="text-align: center;">
<h3 class="oe_slogan" style="color:#337ab7;">Enterprise like backend theme</h3>
<img style="max-width: 100%;" src="screen.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Sidebar App Dashboard. Enable/disable in User Preferences</h3>
<img style="max-width: 100%;" src="sidebar.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Project Dashboard</h3>
<img style="max-width: 100%;" src="project.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Contact form</h3>
<img style="max-width: 100%;" src="contact.png"/><br><br>
<h3 class="oe_slogan" style="color:#337ab7;">Change background</h3>
<img style="max-width: 100%;" src="settings.png"/><br><br>
</div>
</div>
</div>
</section>

<section class="oe_container oe_separator">
</section>

<section class="oe_container" style="background-color:#e8e8e8; padding:20px 0px 90px 0px">
<div class="oe_row">

<div class="oe_span12">
<div class="oe_centeralign">
<p>Remark: It is possible that the Odoo service needs to be restarted after install.</p>
</div>
</div>
</div>
</section>

<section class="oe_container oe_separator">
</section>

39 changes: 20 additions & 19 deletions backend_theme_v10/static/src/js/sidebar-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */

odoo.define('backend_theme_v10.sidebar-toggle', function (require) {
"use strict";

var session = require('web.session');
var Model = require('web.DataModel');

var id = session.uid;

new Model('res.users').query(['sidebar_visible'])
.filter([['id', '=', id]])
.first()
.then(function(res) {
var toggle = res["sidebar_visible"];
if (toggle === true) {
$("#app-sidebar").removeClass("toggle-sidebar");
} else {
$("#app-sidebar").addClass("toggle-sidebar");
};
});
});
'use strict'

var session = require('web.session')
var Model = require('web.DataModel')

var id = session.uid

new Model('res.users').query(['sidebar_visible'])
.filter([['id', '=', id]])
.first()
.then(function (res) {
var toggle = res['sidebar_visible']
if (toggle === true) {
$('#app-sidebar').removeClass('toggle-sidebar')
} else {
$('#app-sidebar').addClass('toggle-sidebar')
}

})
})
58 changes: 29 additions & 29 deletions backend_theme_v10/static/src/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */

// Check if debug mode is active and then add debug into URL when clicking on the App sidebar
odoo.define('backend_theme_v11.Sidebar', function(require) {
"use strict";
var core = require('web.core');
var session = require('web.session');
var Widget = require('web.Widget');
$(function() {
(function($) {
$.addDebug = function(url) {
url = url.replace(/(.{4})/, "$1?debug");
return url;
}
$.addDebugWithAssets = function(url) {
url = url.replace(/(.{4})/, "$1?debug=assets");
return url;
}
$.delDebug = function(url) {
var str = url.match(/web(\S*)#/);
url = url.replace("str/g", "");
return url;
}
}) (jQuery);
$("#sidebar a").each(function() {
var url = $(this).attr('href');
if (session.debug == 1) $(this).attr('href', $.addDebug(url));
if (session.debug == 'assets') $(this).attr('href', $.addDebugWithAssets(url));
if (session.debug == false) $(this).attr('href', $.delDebug(url));
});
});
});
odoo.define('backend_theme_v11.Sidebar', function (require) {
'use strict'
var core = require('web.core')
var session = require('web.session')
var Widget = require('web.Widget')
$(function () {
(function ($) {
$.addDebug = function (url) {
url = url.replace(/(.{4})/, '$1?debug')
return url
}
$.addDebugWithAssets = function (url) {
url = url.replace(/(.{4})/, '$1?debug=assets')
return url
}
$.delDebug = function (url) {
var str = url.match(/web(\S*)#/)
url = url.replace('str/g', '')
return url
}
})(jQuery)
$('#sidebar a').each(function () {
var url = $(this).attr('href')
if (session.debug == 1) $(this).attr('href', $.addDebug(url))
if (session.debug == 'assets') $(this).attr('href', $.addDebugWithAssets(url))
if (session.debug == false) $(this).attr('href', $.delDebug(url))
})
})
})
Loading