diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..16242d5 --- /dev/null +++ b/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- + +import models +import controllers +import wizard \ No newline at end of file diff --git a/__openerp__.py b/__openerp__.py new file mode 100644 index 0000000..2e768b7 --- /dev/null +++ b/__openerp__.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +{ + "name": "Customizable Interface", + "version": "8.0.1.0.4", + "category": "Extra Tools", + "author": "Archived", + "website": "", + "license": "AGPL-3", + "application": True, + "installable": True, + "auto_install": False, + "depends": [ + "base", + "web", + "mail" + ], + "data": [ + "data/data.xml", + "security/ir.model.access.csv", + "views/include_css.xml", + "views/colors_customization.xml", + "views/res_company.xml", + "views/interface_conf.xml", + "views/no_knock_to_odoo.xml" + ], + "qweb": [ + "static/src/xml/*.xml" + ], + "js": [ + + ], + "demo": [ + + ], + "external_dependencies": {}, + "summary": "The module is not any more supported", + "description": """ +The module is not any more supported +""", + "images": [ + "static/description/main.png" + ], + "price": "70.0", + "currency": "EUR", +} \ No newline at end of file diff --git a/controllers/__init__.py b/controllers/__init__.py new file mode 100644 index 0000000..56870b5 --- /dev/null +++ b/controllers/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +import main +import web_contr \ No newline at end of file diff --git a/controllers/main.py b/controllers/main.py new file mode 100644 index 0000000..981ae69 --- /dev/null +++ b/controllers/main.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- + +import openerp +from openerp import http +from openerp.http import request +from openerp.addons.web.controllers.main import Session +from werkzeug.wrappers import Request, Response + + +class CustomCss(http.Controller): + + @http.route('/custom_colors', type='http', auth="none") + def get_colors(self): + custom_css = '' + current_user = request.env['res.users'].sudo().search([('id', '=', request.context.get('uid'))]) + if current_user and current_user[0].company_color_theme: + custom_css = current_user[0].company_color_theme.css + return Response(str(custom_css), mimetype='text/css') \ No newline at end of file diff --git a/controllers/web_contr.py b/controllers/web_contr.py new file mode 100644 index 0000000..2cd88dc --- /dev/null +++ b/controllers/web_contr.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- + +import re +import openerp +import functools + +from openerp import SUPERUSER_ID +from openerp import http +from openerp.http import request +from openerp.tools.translate import _ +from openerp.addons.web.controllers.main import Home +from openerp.addons.web.controllers.main import Binary +from openerp.addons.web.controllers.main import ensure_db +from openerp.addons.web.controllers.main import login_redirect +from openerp.modules import get_module_resource +from cStringIO import StringIO + +class HomeStyle(Home): + + @http.route('/web', type='http', auth="none") + def web_client(self, s_action=None, **kw): + ensure_db() + if request.session.uid: + if kw.get('redirect'): + return werkzeug.utils.redirect(kw.get('redirect'), 303) + if not request.uid: + request.uid = request.session.uid + + theme_id = request.registry['res.users'].browse(request.cr,request.uid,request.uid, context=request.context).company_color_theme + theme_data = False + if theme_id: + if theme_id.footer_color: + footer_color = theme_id.footer_color + else: + footer_color = '#a24689' + + if theme_id.footer_url: + footer_url = theme_id.footer_url + else: + footer_url = '/web' + + theme_data = { + 'footer_text':theme_id.footer_text, + 'footer_url':footer_url, + 'url_favicon':theme_id.url_favicon, + 'footer_color':footer_color, + 'meta_title':theme_id.meta_title + } + else: + theme_data = { + 'footer_text':False, + 'footer_url':False, + 'url_favicon':False, + 'footer_color':False, + 'meta_title':False, + } + + menu_data = request.registry['ir.ui.menu'].load_menus(request.cr, request.uid, context=request.context) + return request.render('web.webclient_bootstrap', qcontext={'menu_data': menu_data,'theme_data':theme_data}) + else: + return login_redirect() + + +class Binary_ITL(Binary): + + @http.route([ + '/web/binary/company_logo', + '/logo', + '/logo.png', + ], type='http', auth="none", cors="*") + def company_logo(self, dbname=None, **kw): + imgname = 'placeholder.png' + placeholder = functools.partial(get_module_resource, 'web', 'static', 'src', 'img') + uid = None + if request.session.db: + dbname = request.session.db + uid = request.session.uid + elif dbname is None: + dbname = db_monodb() + + if not uid: + uid = openerp.SUPERUSER_ID + + if not dbname: + response = http.send_file(placeholder(imgname)) + else: + try: + # create an empty registry + registry = openerp.modules.registry.Registry(dbname) + with registry.cursor() as cr: + cr.execute("""SELECT c.logo_web, c.write_date + FROM res_users u + LEFT JOIN res_company c + ON c.id = u.company_id + WHERE u.id = %s + """, (uid,)) + row = cr.fetchone() + if row and row[0]: + image_data = StringIO(str(row[0]).decode('base64')) + response = http.send_file(image_data, filename=imgname, mtime=row[1]) + else: + response = http.send_file(placeholder('placeholder.png')) + except Exception: + response = http.send_file(placeholder(imgname)) + + return response diff --git a/data/data.xml b/data/data.xml new file mode 100644 index 0000000..dafea69 --- /dev/null +++ b/data/data.xml @@ -0,0 +1,89 @@ + + + + + + IT Libertas + + + #EEEEF5 + #BCE8F1 + #428BCA + #FFFFFF + #428BCA + #121212 + #FFFFFF + + #F0F7FF + #428BCA + #777777 + #FFFFFF + #428BCA + #121212 + #FFFFFF + + #F0F7FF + #EEEEF5 + + Inspired by IT Libertas + https://itlibertas.com + #31708F + + + ITL + + + + Froggy + + + #DBDBDB + #9CA8A6 + #39CA64 + #006629 + #FFFFFF + #080808 + #DEFFAD + + #DBDBDB + #4BA816 + #39CA64 + #006629 + #FFFFFF + #080808 + #DEFFAD + + #DBDBDB + #B3C9B4 + + Inspired by IT Libertas + https://itlibertas.com + #006629 + + + ITL + + + + Poppy + + + #DB0000 + #A80000 + #CABCBC + #000000 + + #3B3B3B + #DB0000 + #FF0000 + #000000 + + Inspired by IT Libertas + https://itlibertas.com + #A80000 + + + ITL + + + \ No newline at end of file diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..4016ee1 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,6 @@ +Requirements and exceptions +=========================== +* Before installing the app uninstall the modules which modify Odoo web templates: e.g. remove some branding or styling. Potential contradiction may appear +* In some Odoo versions this app's installation may lead to Odoo users' group bug (users form are not opened or menus are broken). In that case just update the 'base' module +* The module depends on web, web_widget_color and mail modules +* Find themes under the menu unit Settings > Interface > Themes \ No newline at end of file diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..2683ef6 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- + +import custom_colors +import res_company +import configs +import no_knock_odoo +import mail \ No newline at end of file diff --git a/models/configs.py b/models/configs.py new file mode 100644 index 0000000..0993c6c --- /dev/null +++ b/models/configs.py @@ -0,0 +1,15 @@ +#coding: utf-8 +from openerp import models, fields, api, _, tools + +class interface_conf(models.TransientModel): + _name = 'interface.conf' + _description = 'Interface Settings' + + company_id = fields.Many2one('res.company',string='Company',required=True,default=lambda self: self.env.user.company_id or False) + user_own_theme = fields.Boolean(related='company_id.user_own_theme') + custom_email_footer = fields.Char(related='company_id.custom_email_footer',translate=True) + footer_link = fields.Char(related='company_id.footer_link',translate=True) + + @api.one + def execute(self): + return True \ No newline at end of file diff --git a/models/custom_colors.py b/models/custom_colors.py new file mode 100644 index 0000000..94cf13e --- /dev/null +++ b/models/custom_colors.py @@ -0,0 +1,144 @@ +# -*- coding: utf-8 -*- + +from openerp import models, fields, api, _, tools + + +class color_theme(models.Model): + _name = 'colors.customization.theme' + + def _get_properties(self): + return [ + ('nav.navbar-inverse', 'background-color', self.navbar_color), + ('nav.navbar-inverse', 'border-color', self.navbar_border_color), + ('.navbar-inverse .navbar-nav > li > a', 'color', self.menu_font_color), + ('.navbar-inverse .navbar-nav > .active > a, .navbar-inverse .navbar-nav > .active > a:focus', 'color', self.navbar_active_item_font_color), + ('.navbar-inverse .navbar-nav > li.active > a', 'background-color', self.menu_active_item_color), + ('.navbar-inverse .navbar-nav > li > a:hover', 'color', self.navbar_hover_font_color), + ('.navbar-inverse .navbar-nav > li > a:hover', 'background-color', self.navbar_hover_background_color), + ('.oe_leftbar', 'background', self.left_bar_color), + ('.nav-pills li > a', 'color', self.left_bar_font_color), + ('.oe_secondary_menu_section', 'color', self.left_bar_category_font_color), + ('.nav-pills > li.active > a', 'background-color', self.left_bar_active_item_color), + ('.nav-pills > li.active > a', 'color', self.left_bar_active_item_font_color), + ('.nav-pills > li > a:hover', 'color', self.left_bar_hover_font_color), + ('.nav-pills > li > a:hover', 'background-color', self.left_bar_hover_background_color), + + ('.openerp .oe_view_manager_current > .oe_view_manager_header', 'background-color', self.header_table_color), + ('.openerp .oe_view_manager_current > .oe_view_manager_header', 'background-image', self.webkit_gradient), + ('.openerp .oe_view_manager_current > .oe_view_manager_header', 'background-image', self.linear_gradient), + ('.openerp .oe_view_manager_current > .oe_view_manager_header', 'background-image', self.moz_gradient), + ('.openerp .oe_view_manager_current > .oe_view_manager_header', 'background-image', self.ms_gradient), + ('.openerp .oe_view_manager_current > .oe_view_manager_header', 'background-image', self.lin_gradient), + ('.openerp .oe_view_manager_current > .oe_view_manager_header', 'background-image', self.gradient_bot), + ] + + def _build_rule(self, selector, prop, value): + return "{s} {{ {p}: {v} !important;}}\n".format(s=selector, p=prop, v=value) + + @api.depends('navbar_color', 'navbar_border_color', + 'menu_font_color', 'left_bar_color', + 'menu_active_item_color', + 'navbar_hover_font_color','navbar_hover_background_color', + 'left_bar_font_color', 'left_bar_category_font_color', + 'left_bar_active_item_color', 'navbar_active_item_font_color', + 'left_bar_active_item_font_color', + 'left_bar_hover_font_color','left_bar_hover_background_color', + 'header_table_color','header_table_color_2',) + def _get_css(self): + result = '' + for field in self._get_properties(): + result += self._build_rule(field[0], field[1], field[2]) + self.css = result + + name = fields.Char('Name',required=True,translate=True) + css = fields.Char(compute='_get_css', store=True, string="CSS") + + navbar_color = fields.Char('Background Color') + navbar_border_color = fields.Char('Border Color') + navbar_active_item_font_color = fields.Char('Active Item Font Color') + menu_font_color = fields.Char('Font Color') + menu_active_item_color = fields.Char('Active Item Background Color') + navbar_hover_font_color = fields.Char('Hover Font Color') + navbar_hover_background_color = fields.Char('Hover Background Color') + + left_bar_color = fields.Char('Background Color') + left_bar_font_color = fields.Char('Sub Menu Color') + left_bar_category_font_color = fields.Char('Main Menu Color') + left_bar_active_item_font_color = fields.Char('Active Item Font Color') + left_bar_active_item_color = fields.Char('Active Item Background Color') + left_bar_hover_font_color = fields.Char('Hover Font Color') + left_bar_hover_background_color = fields.Char('Hover Background Color') + + @api.one + def get_header_gradient_webkit(self): + if self.header_table_color and self.header_table_color_2: + self.webkit_gradient = '-webkit-gradient(linear, left top, left bottom, from('+self.header_table_color+'), to('+self.header_table_color_2+'))' + self.linear_gradient ='-webkit-linear-gradient(top, '+self.header_table_color+', '+self.header_table_color_2+')' + self.moz_gradient = '-moz-linear-gradient(top,'+self.header_table_color+', '+self.header_table_color_2+')' + self.ms_gradient = '-ms-linear-gradient(top,'+self.header_table_color+', '+self.header_table_color_2+')' + self.lin_gradient = '-o-linear-gradient(top,'+self.header_table_color+', '+self.header_table_color_2+')' + self.gradient_bot = 'linear-gradient(to bottom,'+self.header_table_color+', '+self.header_table_color_2+')' + else: + self.webkit_gradient = self.linear_gradient = self.moz_gradient = self.ms_gradient = self.lin_gradient = self.gradient_bot = False + + + header_table_color = fields.Char('Header Section Background (Gradient)') + header_table_color_2 = fields.Char('Header Section Background 2') + webkit_gradient = fields.Char('Gradient',compute='get_header_gradient_webkit') + linear_gradient = fields.Char('Gradient',compute='get_header_gradient_webkit') + moz_gradient = fields.Char('Gradient',compute='get_header_gradient_webkit') + ms_gradient = fields.Char('Gradient',compute='get_header_gradient_webkit') + lin_gradient = fields.Char('Gradient',compute='get_header_gradient_webkit') + gradient_bot = fields.Char('Gradient',compute='get_header_gradient_webkit') + + + @api.one + def assign_to_all_users(self): + for user in self.env['res.users'].search([]): + user.company_color_theme = self + + users = fields.One2many('res.users','company_color_theme',string='Users',help='Only one theme may be specified to a user') + + @api.one + def change_default_theme(self): + if self.default_for_new_users: + for theme in self.search([('id','!=',self.id)]): + theme.default_for_new_users = False + + default_for_new_users = fields.Boolean(string='Default',inverse='change_default_theme',help='This theme would be applied to new users. There could be only one default theme') + + @api.one + @api.depends('image') + def _get_image(self): + images = tools.image_get_resized_images(self.image) + self.image_small = images.get('image_small') + self.image_medium = images.get('image_medium') + + + image = fields.Binary(string='Favicon') + image_medium = fields.Binary(compute='_get_image',store=True,string='Image Medium') + image_small = fields.Binary(compute='_get_image',store=True,string='Image Small') + + @api.one + @api.depends('image_small') + def get_image_small_url(self): + self.url_favicon = "web/binary/image?model=colors.customization.theme&id="+ str(self.id) +"&field=image_small" + + + url_favicon = fields.Char(compute='get_image_small_url') + + footer_text = fields.Char(string='Footer', help='Leave it empty to delete a footer at all',translate=True) + footer_url = fields.Char(string='URL',help='Use http or https to have an absolute url') + footer_color = fields.Char(string='Color') + + remove_menu_preferences = fields.Boolean(string='Hide Preferences',help='From the user menu',default=False) + remove_menu_account = fields.Boolean(string='Hide Account',help='From the user menu',default=True) + remove_menu_help = fields.Boolean(string='Hide Help',help='From the user menu',default=True) + remove_menu_about = fields.Boolean(string='Hide Deveoper Mode (About)',help='From the user menu',default=False) + + meta_title = fields.Char(string='Page Title',help='Instead of Odoo') + + _order = 'id' + + + diff --git a/models/mail.py b/models/mail.py new file mode 100644 index 0000000..f9f022f --- /dev/null +++ b/models/mail.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- + +from openerp.osv import osv, fields +from openerp import tools, SUPERUSER_ID +from openerp.tools.translate import _ +from openerp.tools.mail import plaintext2html +from urlparse import urljoin + +class mail_mail(osv.Model): + _name = "mail.mail" + _inherit = "mail.mail" + + def send_get_mail_body(self, cr, uid, mail, partner=None, context=None): + body = mail.body_html + link = None + user = self.pool.get("res.users").browse(cr, SUPERUSER_ID, uid, context=context)[0] + + signature_company = "" + if user.company_id.custom_email_footer and user.company_id.custom_email_footer != '': + signature_company = '
' + user.company_id.custom_email_footer + if partner and partner.lang: + signature_company = '
' + user.with_context(lang=partner.lang).company_id.custom_email_footer + + body = tools.append_content_to_html(body, signature_company, plaintext=False, container_tag='div') + + if user.company_id.footer_link and user.company_id.footer_link.find('*'): + if mail.notification or (mail.model and mail.res_id and not mail.no_auto_thread): + link = self._get_partner_access_link(cr, uid, mail, partner, context=context) + if link: + index_begin = link.find('') +4 + url = link[index_begin:index_end] + + footer_link = user.company_id.footer_link + if partner and partner.lang: + footer_link = user.with_context(lang=partner.lang).company_id.footer_link + + link = footer_link.replace('*',url) + body = tools.append_content_to_html(body, link, plaintext=False, container_tag='div') + return body + + +class mail_notification(osv.Model): + _name = "mail.notification" + _inherit = "mail.notification" + + def get_signature_footer(self, cr, uid, user_id, res_model=None, res_id=None, context=None, user_signature=True): + footer = "" + if not user_id: + return footer + + # add user signature + user = self.pool.get("res.users").browse(cr, SUPERUSER_ID, [user_id], context=context)[0] + if user_signature: + if user.signature: + signature = user.signature + else: + signature = "--
%s" % user.name + footer = tools.append_content_to_html(footer, signature, plaintext=False) + + return footer + +mail_notification() \ No newline at end of file diff --git a/models/no_knock_odoo.py b/models/no_knock_odoo.py new file mode 100644 index 0000000..213d48e --- /dev/null +++ b/models/no_knock_odoo.py @@ -0,0 +1,8 @@ +# -*- coding: utf-8 -*- +from openerp.osv import osv +class Waranty(osv.osv): + _inherit = 'publisher_warranty.contract' + + def update_notification(self, cr, uid, ids, cron_mode=True, + context=None): + return True diff --git a/models/res_company.py b/models/res_company.py new file mode 100644 index 0000000..3c45cb4 --- /dev/null +++ b/models/res_company.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- + +from openerp import models, fields, api, _ + +class res_company(models.Model): + _inherit = 'res.company' + + user_own_theme = fields.Boolean('Allow users to change an interface theme through preferences',default=True) + custom_email_footer = fields.Char(string='Footer Text',translate=True, + help=""" +Some marketing info attached to all emails: e.g. website instead of standard 'sent by ... using Odoo' +Leave it empty to send emails without footers at all. +You may use html tags here, including urls. +""") + footer_link = fields.Char(string='Object Link in Footer',translate=True, +help=""" +A link to the object where this email comes form: use it instead of standard 'access directly ...'' +Leave it empty no to add url at all +Put here text in a format 'Some text * Some Text'. +E.g. 'Access * ' which would be translated in 'Access Lead Super'. +Be cautious: do not remove *. Otherwise, link would not be added to emails. +""") + +class res_users(models.Model): + _inherit = 'res.users' + + def __init__(self, pool, cr): + init_res = super(res_users, self).__init__(pool, cr) + self.SELF_WRITEABLE_FIELDS = list(self.SELF_WRITEABLE_FIELDS) + self.SELF_WRITEABLE_FIELDS.extend(['company_color_theme']) + return init_res + + def get_default_theme(self): + themes = self.env['colors.customization.theme'].search([('default_for_new_users','=',True)]) + if themes and len(themes) > 0: + return themes[0].id + else: + return themes + + company_color_theme = fields.Many2one('colors.customization.theme', string="Interface theme",default=get_default_theme) + user_own_theme = fields.Boolean(related='company_id.user_own_theme') \ No newline at end of file diff --git a/security/ir.model.access.csv b/security/ir.model.access.csv new file mode 100644 index 0000000..2c7dd56 --- /dev/null +++ b/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink + +access_colors_customization_theme,access_colors_customization_theme,model_colors_customization_theme,,1,0,0,0 +access_colors_customization_theme_erp_manager,access_colors_customization_theme_manager,model_colors_customization_theme,base.group_erp_manager,1,1,1,1 \ No newline at end of file diff --git a/static/description/app_1.png b/static/description/app_1.png new file mode 100644 index 0000000..93d5ee8 Binary files /dev/null and b/static/description/app_1.png differ diff --git a/static/description/app_2.png b/static/description/app_2.png new file mode 100644 index 0000000..c653803 Binary files /dev/null and b/static/description/app_2.png differ diff --git a/static/description/app_3.png b/static/description/app_3.png new file mode 100644 index 0000000..7221a90 Binary files /dev/null and b/static/description/app_3.png differ diff --git a/static/description/index.html b/static/description/index.html new file mode 100644 index 0000000..324bb39 --- /dev/null +++ b/static/description/index.html @@ -0,0 +1,15 @@ + +
+ +
+
+

+ The module is not any more supported +

+
+
+ + +
+ + \ No newline at end of file diff --git a/static/description/product_screening.png b/static/description/product_screening.png new file mode 100644 index 0000000..c5e8689 Binary files /dev/null and b/static/description/product_screening.png differ diff --git a/static/description/site.png b/static/description/site.png new file mode 100644 index 0000000..bd5f480 Binary files /dev/null and b/static/description/site.png differ diff --git a/static/description/theme_mails.png b/static/description/theme_mails.png new file mode 100644 index 0000000..e4ed599 Binary files /dev/null and b/static/description/theme_mails.png differ diff --git a/static/description/theme_show_functions.png b/static/description/theme_show_functions.png new file mode 100644 index 0000000..f5a1fa7 Binary files /dev/null and b/static/description/theme_show_functions.png differ diff --git a/static/description/theme_user_menu_res.png b/static/description/theme_user_menu_res.png new file mode 100644 index 0000000..7212f3d Binary files /dev/null and b/static/description/theme_user_menu_res.png differ diff --git a/static/description/themes_list.png b/static/description/themes_list.png new file mode 100644 index 0000000..7a1fbbc Binary files /dev/null and b/static/description/themes_list.png differ diff --git a/static/description/user_preferences.png b/static/description/user_preferences.png new file mode 100644 index 0000000..46ab7fb Binary files /dev/null and b/static/description/user_preferences.png differ diff --git a/static/src/css/kanban.css b/static/src/css/kanban.css new file mode 100644 index 0000000..4c2320b --- /dev/null +++ b/static/src/css/kanban.css @@ -0,0 +1,3 @@ +.oe_kanban_group_title_vertical { + writing-mode: inherit ! important; +} \ No newline at end of file diff --git a/static/src/img/frog-favicon.png b/static/src/img/frog-favicon.png new file mode 100644 index 0000000..4268964 Binary files /dev/null and b/static/src/img/frog-favicon.png differ diff --git a/static/src/img/itl_favicon.png b/static/src/img/itl_favicon.png new file mode 100644 index 0000000..5cfb955 Binary files /dev/null and b/static/src/img/itl_favicon.png differ diff --git a/static/src/img/poppy-favicon.png b/static/src/img/poppy-favicon.png new file mode 100644 index 0000000..7d89632 Binary files /dev/null and b/static/src/img/poppy-favicon.png differ diff --git a/static/src/js/menu.js b/static/src/js/menu.js new file mode 100644 index 0000000..c227025 --- /dev/null +++ b/static/src/js/menu.js @@ -0,0 +1,122 @@ +openerp.colors_customization = function (openerp) { + + var instance = openerp; + openerp.web.chrome = {}; + + var QWeb = instance.web.qweb, + _t = instance.web._t; + + + instance.web.UserMenu = instance.web.UserMenu.extend({ + do_update: function () { + var res = this._super.apply(this, arguments); + var self = this; + var fct = function() { + var $avatar = self.$el.find('.oe_topbar_avatar'); + $avatar.attr('src', $avatar.data('default-src')); + if (!self.session.uid) + return; + var func = new instance.web.Model("res.users").get_func("read"); + + var Users = new openerp.Model('res.users'); + Users.query(['name']) + .filter([['id','=',self.session.uid]]) + .first().then(function(user) { + var Themes = new openerp.Model('colors.customization.theme'); + Themes.query(['name','remove_menu_account','remove_menu_preferences','remove_menu_about','remove_menu_help']) + .filter([['users','=',user.id]]) + .first().then(function(theme) { + if (theme) { + var $account_menu = self.$el.find("a[data-menu]"); + $account_menu.each(function(index,menu_obj){ + if (menu_obj.getAttribute('data-menu') == 'account'){ + if(theme.remove_menu_account){ + menu_obj.remove(); + }; + }; + if (menu_obj.getAttribute('data-menu') == 'settings'){ + if(theme.remove_menu_preferences){ + menu_obj.remove(); + }; + }; + if (menu_obj.getAttribute('data-menu') == 'about'){ + if(theme.remove_menu_about){ + menu_obj.remove(); + }; + }; + if (menu_obj.getAttribute('data-menu') == 'help'){ + if(theme.remove_menu_help){ + menu_obj.remove(); + }; + }; + }); + }; + }); + }); + + return self.alive(func(self.session.uid, ["name", "company_id"])).then(function(res) { + var topbar_name = res.name; + if(instance.session.debug) + topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.session.db); + if(res.company_id[0] > 1) + topbar_name = _.str.sprintf("%s (%s)", topbar_name, res.company_id[1]); + self.$el.find('.oe_topbar_name').text(topbar_name); + if (!instance.session.debug) { + topbar_name = _.str.sprintf("%s (%s)", topbar_name, instance.session.db); + } + var avatar_src = self.session.url('/web/binary/image', {model:'res.users', field: 'image_small', id: self.session.uid}); + $avatar.attr('src', avatar_src); + + openerp.web.bus.trigger('resize'); // Re-trigger the reflow logic + }); + }; + + this.update_promise = this.update_promise.then(fct, fct); + }, + }); + + + instance.web.WebClient = instance.web.WebClient.extend({ + init: function(parent, client_options) { + this._super(parent); + if (client_options) { + _.extend(this.client_options, client_options); + } + this._current_state = null; + this.menu_dm = new instance.web.DropMisordered(); + this.action_mutex = new $.Mutex(); + this.set('title_part', {"zopenerp": ""}); + + + var self = this; + + openerp.session.rpc("/web/session/get_session_info", {}).then(function(result) { + if (result.uid) { + var Users = new openerp.Model('res.users'); + Users.query(['name']) + .filter([['id','=',result.uid]]) + .first().then(function(user) { + var Themes = new openerp.Model('colors.customization.theme'); + Themes.query(['name','meta_title']) + .filter([['users','=',user.id]]) + .first().then(function(theme) { + if (theme) { + if(theme.meta_title){ + self.set('title_part', {"zopenerp": theme.meta_title}); + }; + + }; + }); + }); + } + + }); + + + + }, + + + + }); +}; \ No newline at end of file diff --git a/static/src/xml/menu_style.xml b/static/src/xml/menu_style.xml new file mode 100644 index 0000000..dee5c3f --- /dev/null +++ b/static/src/xml/menu_style.xml @@ -0,0 +1,15 @@ + + + + + +
Developer Mode + + + + + + + \ No newline at end of file diff --git a/views/colors_customization.xml b/views/colors_customization.xml new file mode 100644 index 0000000..74e5721 --- /dev/null +++ b/views/colors_customization.xml @@ -0,0 +1,107 @@ + + + + + Themes + colors.customization.theme + + + + + + + + + + Custom color theme + colors.customization.theme + +
+ +
+

+ +

+
+ +
+
+
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + Themes + ir.actions.act_window + colors.customization.theme + form + tree,form + + + + + + + \ No newline at end of file diff --git a/views/include_css.xml b/views/include_css.xml new file mode 100644 index 0000000..7d3ee09 --- /dev/null +++ b/views/include_css.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/views/interface_conf.xml b/views/interface_conf.xml new file mode 100644 index 0000000..fafd43a --- /dev/null +++ b/views/interface_conf.xml @@ -0,0 +1,42 @@ + + + + + interface settings + interface.conf + +
+
+
+
+ + + + + + + + + + + +
+
+
+
+ + Settings + ir.actions.act_window + interface.conf + form + inline + + + + + +
+
diff --git a/views/no_knock_to_odoo.xml b/views/no_knock_to_odoo.xml new file mode 100644 index 0000000..c2aa595 --- /dev/null +++ b/views/no_knock_to_odoo.xml @@ -0,0 +1,18 @@ + + + + + Update Notification + + + -1 + 1 + weeks + + + + + 1000 + + + \ No newline at end of file diff --git a/views/res_company.xml b/views/res_company.xml new file mode 100644 index 0000000..e2217ef --- /dev/null +++ b/views/res_company.xml @@ -0,0 +1,45 @@ + + + + res.company.form + res.company + + + + + + + + + + + + + + + + + res.users.preferences.theme + res.users + + + + + + + + + + + + res.users.theme + res.users + + + + + + + + + \ No newline at end of file diff --git a/wizard/__init__.py b/wizard/__init__.py new file mode 100644 index 0000000..7c68785 --- /dev/null +++ b/wizard/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- \ No newline at end of file