Skip to content

Commit 4988568

Browse files
committed
[IMP] Added .editorconfig to standarize editors' behavior
Added `.editorconfig` and reformatted all files to conform with that configuration. This is important to facilitate the process of contributing to this project and keep the diffs at minimum.
1 parent 700018c commit 4988568

18 files changed

Lines changed: 1424 additions & 1453 deletions

.editorconfig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
tab_width = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
[*.md]
13+
trim_trailing_whitespace = false

backend_theme_v10/__manifest__.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,27 @@
33
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
44

55
{
6-
"name": "Material/United Backend Theme",
7-
"summary": "Odoo 10.0 community backend theme",
8-
"version": "10.0.1.0.23",
9-
"category": "Themes/Backend",
10-
"website": "http://www.openworx.nl",
11-
"description": """
6+
"name": "Material/United Backend Theme",
7+
"summary": "Odoo 10.0 community backend theme",
8+
"version": "10.0.1.0.23",
9+
"category": "Themes/Backend",
10+
"website": "http://www.openworx.nl",
11+
"description": """
1212
Backend theme for Odoo 10.0 community edition.
1313
""",
14-
'images':[
15-
'images/screen.png'
16-
],
17-
"author": "Openworx",
18-
"license": "LGPL-3",
19-
"installable": True,
20-
"depends": [
21-
'web_responsive',
22-
],
23-
"data": [
24-
'views/assets.xml',
25-
'views/res_company_view.xml',
26-
'views/users.xml',
27-
'views/sidebar.xml',
28-
],
14+
'images': [
15+
'images/screen.png'
16+
],
17+
"author": "Openworx",
18+
"license": "LGPL-3",
19+
"installable": True,
20+
"depends": [
21+
'web_responsive',
22+
],
23+
"data": [
24+
'views/assets.xml',
25+
'views/res_company_view.xml',
26+
'views/users.xml',
27+
'views/sidebar.xml',
28+
],
2929
}
30-
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# -*- coding: utf-8 -*-
2-
from . import main
2+
from . import main

backend_theme_v10/controllers/main.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
DEFAULT_IMAGE = '/backend_theme_v10/static/src/img/material-background.jpg'
1010

1111
class DasboardBackground(Controller):
12+
@route(['/dashboard'], type='http', auth='user', website=False)
13+
def dashboard(self, **post):
14+
user = request.env.user
15+
company = user.company_id
16+
if company.dashboard_background:
17+
image = base64.b64decode(company.dashboard_background)
18+
else:
19+
return redirect(DEFAULT_IMAGE)
1220

13-
@route(['/dashboard'], type='http', auth='user', website=False)
14-
def dashboard(self, **post):
15-
user = request.env.user
16-
company = user.company_id
17-
if company.dashboard_background:
18-
image = base64.b64decode(company.dashboard_background)
19-
else:
20-
return redirect(DEFAULT_IMAGE)
21-
22-
return request.make_response(
23-
image, [('Content-Type', 'image')])
21+
return request.make_response(
22+
image, [('Content-Type', 'image')])

backend_theme_v10/models/res_company.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from odoo import models, fields
66

77
class ResCompany(models.Model):
8+
_inherit = 'res.company'
89

9-
_inherit = 'res.company'
10-
11-
dashboard_background = fields.Binary(attachment=True)
10+
dashboard_background = fields.Binary(attachment=True)

backend_theme_v10/models/res_users.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@
55
from odoo import models, fields
66

77
class ResUsers(models.Model):
8+
_inherit = 'res.users'
89

9-
_inherit = 'res.users'
10+
sidebar_visible = fields.Boolean("Show App Sidebar", default=True)
1011

11-
sidebar_visible = fields.Boolean("Show App Sidebar", default=True)
12-
13-
def __init__(self, pool, cr):
14-
""" Override of __init__ to add access rights on notification_email_send
15-
and alias fields. Access rights are disabled by default, but allowed
16-
on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
17-
"""
18-
init_res = super(ResUsers, self).__init__(pool, cr)
19-
# duplicate list to avoid modifying the original reference
20-
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
21-
type(self).SELF_WRITEABLE_FIELDS.extend(['sidebar_visible'])
22-
# duplicate list to avoid modifying the original reference
23-
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
24-
type(self).SELF_READABLE_FIELDS.extend(['sidebar_visible'])
25-
return init_res
12+
def __init__(self, pool, cr):
13+
""" Override of __init__ to add access rights on notification_email_send
14+
and alias fields. Access rights are disabled by default, but allowed
15+
on some specific fields defined in self.SELF_{READ/WRITE}ABLE_FIELDS.
16+
"""
17+
init_res = super(ResUsers, self).__init__(pool, cr)
18+
# duplicate list to avoid modifying the original reference
19+
type(self).SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS)
20+
type(self).SELF_WRITEABLE_FIELDS.extend(['sidebar_visible'])
21+
# duplicate list to avoid modifying the original reference
22+
type(self).SELF_READABLE_FIELDS = list(self.SELF_READABLE_FIELDS)
23+
type(self).SELF_READABLE_FIELDS.extend(['sidebar_visible'])
24+
return init_res
Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
<section class="oe_container">
2-
<div class="oe_row oe_spaced">
3-
<div class="oe_span12">
4-
<h1 class="oe_slogan" style="color:#337ab7;">Material/United Backend Theme</h1>
5-
<h2 class="oe_slogan">The first Odoo 10.0 community backend theme</h2>
6-
<div class="oe_screenshot" style="text-align: center;">
7-
<h3 class="oe_slogan" style="color:#337ab7;">Enterprise like backend theme</h3>
8-
<img style="max-width: 100%;" src="screen.png"/><br><br>
9-
<h3 class="oe_slogan" style="color:#337ab7;">Sidebar App Dashboard. Enable/disable in User Preferences</h3>
10-
<img style="max-width: 100%;" src="sidebar.png"/><br><br>
11-
<h3 class="oe_slogan" style="color:#337ab7;">Project Dashboard</h3>
12-
<img style="max-width: 100%;" src="project.png"/><br><br>
13-
<h3 class="oe_slogan" style="color:#337ab7;">Contact form</h3>
14-
<img style="max-width: 100%;" src="contact.png"/><br><br>
15-
<h3 class="oe_slogan" style="color:#337ab7;">Change background</h3>
16-
<img style="max-width: 100%;" src="settings.png"/><br><br>
17-
</div>
18-
</div>
19-
</div>
20-
</section>
21-
22-
<section class="oe_container oe_separator">
23-
</section>
24-
25-
<section class="oe_container" style="background-color:#E8E8E8; padding:20px 0px 90px 0px">
26-
<div class="oe_row">
27-
28-
<div class="oe_span12">
29-
<div class="oe_centeralign">
30-
<p>Remark: It is possible that the Odoo service needs to be restarted after install.</p>
31-
</div>
32-
</div>
33-
</div>
34-
</section>
35-
36-
<section class="oe_container oe_separator">
37-
</section>
38-
1+
<section class="oe_container">
2+
<div class="oe_row oe_spaced">
3+
<div class="oe_span12">
4+
<h1 class="oe_slogan" style="color:#337ab7;">Material/United Backend Theme</h1>
5+
<h2 class="oe_slogan">The first Odoo 10.0 community backend theme</h2>
6+
<div class="oe_screenshot" style="text-align: center;">
7+
<h3 class="oe_slogan" style="color:#337ab7;">Enterprise like backend theme</h3>
8+
<img style="max-width: 100%;" src="screen.png"/><br><br>
9+
<h3 class="oe_slogan" style="color:#337ab7;">Sidebar App Dashboard. Enable/disable in User Preferences</h3>
10+
<img style="max-width: 100%;" src="sidebar.png"/><br><br>
11+
<h3 class="oe_slogan" style="color:#337ab7;">Project Dashboard</h3>
12+
<img style="max-width: 100%;" src="project.png"/><br><br>
13+
<h3 class="oe_slogan" style="color:#337ab7;">Contact form</h3>
14+
<img style="max-width: 100%;" src="contact.png"/><br><br>
15+
<h3 class="oe_slogan" style="color:#337ab7;">Change background</h3>
16+
<img style="max-width: 100%;" src="settings.png"/><br><br>
17+
</div>
18+
</div>
19+
</div>
20+
</section>
21+
22+
<section class="oe_container oe_separator">
23+
</section>
24+
25+
<section class="oe_container" style="background-color:#e8e8e8; padding:20px 0px 90px 0px">
26+
<div class="oe_row">
27+
28+
<div class="oe_span12">
29+
<div class="oe_centeralign">
30+
<p>Remark: It is possible that the Odoo service needs to be restarted after install.</p>
31+
</div>
32+
</div>
33+
</div>
34+
</section>
35+
36+
<section class="oe_container oe_separator">
37+
</section>
38+

backend_theme_v10/static/src/js/sidebar-toggle.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
33

44
odoo.define('backend_theme_v10.sidebar-toggle', function (require) {
5-
"use strict";
6-
7-
var session = require('web.session');
8-
var Model = require('web.DataModel');
9-
10-
var id = session.uid;
11-
12-
new Model('res.users').query(['sidebar_visible'])
13-
.filter([['id', '=', id]])
14-
.first()
15-
.then(function(res) {
16-
var toggle = res["sidebar_visible"];
17-
if (toggle === true) {
18-
$("#app-sidebar").removeClass("toggle-sidebar");
19-
} else {
20-
$("#app-sidebar").addClass("toggle-sidebar");
21-
};
22-
});
23-
});
5+
'use strict'
6+
7+
var session = require('web.session')
8+
var Model = require('web.DataModel')
9+
10+
var id = session.uid
11+
12+
new Model('res.users').query(['sidebar_visible'])
13+
.filter([['id', '=', id]])
14+
.first()
15+
.then(function (res) {
16+
var toggle = res['sidebar_visible']
17+
if (toggle === true) {
18+
$('#app-sidebar').removeClass('toggle-sidebar')
19+
} else {
20+
$('#app-sidebar').addClass('toggle-sidebar')
21+
}
22+
23+
})
24+
})

backend_theme_v10/static/src/js/sidebar.js

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,32 @@
22
* License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). */
33

44
// Check if debug mode is active and then add debug into URL when clicking on the App sidebar
5-
odoo.define('backend_theme_v11.Sidebar', function(require) {
6-
"use strict";
7-
var core = require('web.core');
8-
var session = require('web.session');
9-
var Widget = require('web.Widget');
10-
$(function() {
11-
(function($) {
12-
$.addDebug = function(url) {
13-
url = url.replace(/(.{4})/, "$1?debug");
14-
return url;
15-
}
16-
$.addDebugWithAssets = function(url) {
17-
url = url.replace(/(.{4})/, "$1?debug=assets");
18-
return url;
19-
}
20-
$.delDebug = function(url) {
21-
var str = url.match(/web(\S*)#/);
22-
url = url.replace("str/g", "");
23-
return url;
24-
}
25-
}) (jQuery);
26-
$("#sidebar a").each(function() {
27-
var url = $(this).attr('href');
28-
if (session.debug == 1) $(this).attr('href', $.addDebug(url));
29-
if (session.debug == 'assets') $(this).attr('href', $.addDebugWithAssets(url));
30-
if (session.debug == false) $(this).attr('href', $.delDebug(url));
31-
});
32-
});
33-
});
5+
odoo.define('backend_theme_v11.Sidebar', function (require) {
6+
'use strict'
7+
var core = require('web.core')
8+
var session = require('web.session')
9+
var Widget = require('web.Widget')
10+
$(function () {
11+
(function ($) {
12+
$.addDebug = function (url) {
13+
url = url.replace(/(.{4})/, '$1?debug')
14+
return url
15+
}
16+
$.addDebugWithAssets = function (url) {
17+
url = url.replace(/(.{4})/, '$1?debug=assets')
18+
return url
19+
}
20+
$.delDebug = function (url) {
21+
var str = url.match(/web(\S*)#/)
22+
url = url.replace('str/g', '')
23+
return url
24+
}
25+
})(jQuery)
26+
$('#sidebar a').each(function () {
27+
var url = $(this).attr('href')
28+
if (session.debug == 1) $(this).attr('href', $.addDebug(url))
29+
if (session.debug == 'assets') $(this).attr('href', $.addDebugWithAssets(url))
30+
if (session.debug == false) $(this).attr('href', $.delDebug(url))
31+
})
32+
})
33+
})

0 commit comments

Comments
 (0)