diff --git a/editable_backend_theme/editable_theme/__init__.py b/editable_backend_theme/editable_theme/__init__.py new file mode 100644 index 000000000..2c4eac3f8 --- /dev/null +++ b/editable_backend_theme/editable_theme/__init__.py @@ -0,0 +1 @@ +import models \ No newline at end of file diff --git a/editable_backend_theme/editable_theme/__openerp__.py b/editable_backend_theme/editable_theme/__openerp__.py new file mode 100644 index 000000000..1ac1d8e48 --- /dev/null +++ b/editable_backend_theme/editable_theme/__openerp__.py @@ -0,0 +1,23 @@ +{ + 'name': "Awesome Backend Theme", + 'summary': """ You can simply edit font colour and background colour in this Theme.""", + 'description': """ Your own colors on your interface.""", + 'author': "Cybrosys Tachno Solutions", + 'category': 'Theme', + 'version': '1.0', + + + 'depends': [ + 'base', + 'web_widget_color', ], + + + 'data': ['template/template.xml', + 'views/theme_view.xml', + ], + + + 'installable': True, + 'auto_install': False, + 'application': True, +} diff --git a/editable_backend_theme/editable_theme/models/__init__.py b/editable_backend_theme/editable_theme/models/__init__.py new file mode 100644 index 000000000..8ace6a1f9 --- /dev/null +++ b/editable_backend_theme/editable_theme/models/__init__.py @@ -0,0 +1,2 @@ +import themes +import play_with_js \ No newline at end of file diff --git a/editable_backend_theme/editable_theme/models/play_with_js.py b/editable_backend_theme/editable_theme/models/play_with_js.py new file mode 100644 index 000000000..1c6031ae6 --- /dev/null +++ b/editable_backend_theme/editable_theme/models/play_with_js.py @@ -0,0 +1,64 @@ +from openerp import api, fields, models, http +from openerp.http import request + + +class BackendCss(http.Controller): + + @http.route(['/get_css_selected/'], type='json', auth="public", website=True) + def action_get_css_selected(self): + + sidebar_font_color = request.registry['menu.theme'].get_sidebar_font_color(request.cr, request.uid, []).get('sidebar_font_color') + sidebar_font_color_parent = request.registry['menu.theme'].get_sidebar_font_color_parent(request.cr, request.uid, []).get('sidebar_font_color_parent') + sidebar_image = request.registry['menu.theme'].get_sidebar_image(request.cr, request.uid, []).get('sidebar_image') + top_image = request.registry['menu.theme'].get_top_image(request.cr, request.uid, []).get('top_image') + + top_font_color = request.registry['menu.theme'].get_top_font_color(request.cr, request.uid, []).get('top_font_color') + top_background_color = request.registry['menu.theme'].get_top_background_color(request.cr, request.uid, []).get('top_background_color') + sidebar_background_color = request.registry['menu.theme'].get_sidebar_background_color(request.cr, request.uid, []).get('sidebar_background_color') + font_common = request.registry['menu.theme'].get_font_common(request.cr, request.uid, []).get('font_common') + + css_list = '' + # SIDE BAR IMAGE + if sidebar_image: + css_list += sidebar_image + '-->' + else: + css_list += 'none-->' + # TOP BAR IMAGE + if top_image: + css_list += top_image + '-->' + else: + css_list += 'none-->' + # SIDE BAR FONT COLOR CHILD + if sidebar_font_color: + css_list += sidebar_font_color + '-->' + else: + css_list += 'none-->' + # SIDE BAR FONT COLOR PARENT + if sidebar_font_color_parent: + css_list += sidebar_font_color_parent + '-->' + else: + css_list += 'none-->' + # TOP BAR FONT COLOR + if top_font_color: + css_list += top_font_color + '-->' + else: + css_list += 'none-->' + # TOP BAR BACKGROUND COLOR + if top_background_color: + css_list += top_background_color + '-->' + else: + css_list += 'none-->' + # SIDE BAR BACKGROUND COLOR + if sidebar_background_color: + css_list += sidebar_background_color + '-->' + else: + css_list += 'none-->' + # FONT STYLE + if font_common: + css_list += font_common + '-->' + else: + css_list += 'none-->' + + return css_list + + diff --git a/editable_backend_theme/editable_theme/models/themes.py b/editable_backend_theme/editable_theme/models/themes.py new file mode 100644 index 000000000..7e7f72ce2 --- /dev/null +++ b/editable_backend_theme/editable_theme/models/themes.py @@ -0,0 +1,170 @@ +from openerp import models, fields, api, http, SUPERUSER_ID +from openerp.http import request + + +class MenuThemes(models.Model): + _name = 'menu.theme' + _inherit = 'res.config.settings' + + sidebar_image = fields.Binary('Sidebar BackGround Image', help='You can set image at the left bar behind' + ' the font such as your company logo.' + 'keep this field empty ' + 'if you need background colour.') + top_image = fields.Binary('Top BackGround Image') + sidebar_font_color = fields.Char('Font Colour of Sidebar Child Menu', default='#FFFFFF') + sidebar_font_color_parent = fields.Char('Font Colour of Sidebar Parent Menu', default='#FFDC63') + + top_font_color = fields.Char('Font Colour of Top Menu', default='#FFFFFF') + top_background_color = fields.Char('BackGround Colour of Top Menu', default='#B71E17') + sidebar_background_color = fields.Char('BackGround Colour of Sidebar', default='#464746') + + font_common = fields.Selection([('sans-serif', 'Sans-Serif'), + ('serif', 'Serif'), + ('monospace', 'Monospace'), ], default='monospace') + + # SETTING + # FONT STYLE + def set_font_common(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.font_common: + font_common = wizard.font_common + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme', 'font_common', font_common) + else: + font_common = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme', 'font_common', font_common) + + # SIDEBAR BACKGROUND COLOR + def set_sidebar_background_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.sidebar_background_color: + sidebar_background_color = wizard.sidebar_background_color + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme','sidebar_background_color', sidebar_background_color) + else: + sidebar_background_color = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme','sidebar_background_color', sidebar_background_color) + + # SIDEBAR IMAGE + def set_sidebar_image(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.sidebar_image: + sidebar_image = wizard.sidebar_image + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme','sidebar_image', sidebar_image) + else: + sidebar_image = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme','sidebar_image',sidebar_image) + + # TOP BAR IMAGE + def set_top_image(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.top_image: + top_image = wizard.top_image + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme','top_image', top_image) + else: + top_image = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme','top_image',top_image) + + # FONT COLOUR CHILD + def set_sidebar_font_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.sidebar_font_color: + sidebar_font_color = wizard.sidebar_font_color + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme','sidebar_font_color', sidebar_font_color) + else: + sidebar_font_color = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme','sidebar_font_color',sidebar_font_color) + + # FONT COLOUR PARENT + def set_sidebar_font_color_parent(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.sidebar_font_color_parent: + sidebar_font_color_parent = wizard.sidebar_font_color_parent + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme','sidebar_font_color_parent', sidebar_font_color_parent) + else: + sidebar_font_color_parent = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme','sidebar_font_color_parent',sidebar_font_color_parent) + + # FONT COLOR TOP + def set_top_font_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.top_font_color: + top_font_color = wizard.top_font_color + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme','top_font_color', top_font_color) + else: + top_font_color = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme','top_font_color',top_font_color) + + # TOP BAR FONT COLOR + def set_top_background_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + wizard = self.browse(cr, uid, ids)[0] + if wizard.top_background_color: + top_background_color = wizard.top_background_color + ir_values.set_default(cr, SUPERUSER_ID, 'menu.theme','top_background_color', top_background_color) + else: + top_background_color = False + ir_values.set_default(cr, SUPERUSER_ID,'menu.theme','top_background_color',top_background_color) + + # GETTING + # FONT STYLE + def get_font_common(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + font_common = ir_values.get_default(cr, uid, 'menu.theme', 'font_common') + return { + 'font_common': font_common, } + + # SIDEBAR BACKGROUND COLOR + def get_sidebar_background_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + sidebar_background_color = ir_values.get_default(cr, uid, 'menu.theme', 'sidebar_background_color') + return { + 'sidebar_background_color': sidebar_background_color, } + + # SIDEBAR IMAGE + def get_sidebar_image(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + sidebar_image = ir_values.get_default(cr, uid, 'menu.theme', 'sidebar_image') + return { + 'sidebar_image': sidebar_image, } + + # TOP BAR IMAGE + def get_top_image(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + top_image = ir_values.get_default(cr, uid, 'menu.theme', 'top_image') + return { + 'top_image': top_image, } + + # FONT COLOUR CHILD + def get_sidebar_font_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + sidebar_font_color = ir_values.get_default(cr, uid, 'menu.theme', 'sidebar_font_color') + return { + 'sidebar_font_color': sidebar_font_color, } + + # FONT COLOUR PARENT + def get_sidebar_font_color_parent(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + sidebar_font_color_parent = ir_values.get_default(cr, uid, 'menu.theme', 'sidebar_font_color_parent') + return { + 'sidebar_font_color_parent': sidebar_font_color_parent, } + + # FONT COLOR TOP + def get_top_font_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + top_font_color = ir_values.get_default(cr, uid, 'menu.theme', 'top_font_color') + return { + 'top_font_color': top_font_color, } + + # TOP BAR FONT COLOR + def get_top_background_color(self, cr, uid, ids, context=None): + ir_values = self.pool.get('ir.values') + top_background_color = ir_values.get_default(cr, uid, 'menu.theme', 'top_background_color') + return { + 'top_background_color': top_background_color, } + diff --git a/editable_backend_theme/editable_theme/static/css/backend_style.css b/editable_backend_theme/editable_theme/static/css/backend_style.css new file mode 100644 index 000000000..6a1a457a7 --- /dev/null +++ b/editable_backend_theme/editable_theme/static/css/backend_style.css @@ -0,0 +1,27 @@ +#demo_sans_serif{color:#8A8C9C;font-family:sans-serif;} +#demo_serif{color:#8A8C9C;font-family:serif;} +#demo_monospace{color:#8A8C9C;font-family:monospace;} +/*DEFAULT THEME*/ +/* +.openerp .oe_menu_text{color:#FFFFFF;font-family:monospace;} +.openerp .oe_secondary_menu_section{color:#FFDC63;font-family:monospace;} +.navbar-inverse .navbar-nav > li > a{color:#FFFFFF} +.navbar-collapse.collapse{background-color:#B71E17} +.oe_leftbar{background-color:#464746;font-family:monospace;} +a{font-family:monospace;} + +.oe_leftbar{background-color:#464746;font-family:monospace;}*/ + +/*.oe_form_label{font-family:monospace;}*/ +/* +.openerp .oe_form td.oe_form_group_cell_label { + +font-family:monospace; + +}*/ +/*label{font-family:monospace;}*/ + +/*SIDE BAR IMAGE FULL SIZE*/ +.openerp .oe_leftbar { + background-size: 100% 100%; +} \ No newline at end of file diff --git a/editable_backend_theme/editable_theme/static/description/icon.png b/editable_backend_theme/editable_theme/static/description/icon.png new file mode 100644 index 000000000..025b24d08 Binary files /dev/null and b/editable_backend_theme/editable_theme/static/description/icon.png differ diff --git a/editable_backend_theme/editable_theme/static/description/index.html b/editable_backend_theme/editable_theme/static/description/index.html new file mode 100644 index 000000000..db45ef8c4 --- /dev/null +++ b/editable_backend_theme/editable_theme/static/description/index.html @@ -0,0 +1,112 @@ +
+
+

Awesome Backend Theme

+
+
+ +
+
+
+
+ +
+
+
+
+ + +
+
+
+
+ +
+
+
+


+

+ User defined colours for theme. +

+

+ Activate Technical Features.
+ Then go to
+ Settings