Initial commit
|
@ -0,0 +1,5 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import models
|
||||
import controllers
|
||||
import wizard
|
|
@ -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",
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import main
|
||||
import web_contr
|
|
@ -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')
|
|
@ -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
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<!-- IT LIBERTAS -->
|
||||
<record model="colors.customization.theme" id="itlibertas_theme">
|
||||
<field name="name">IT Libertas</field>
|
||||
<field name="default_for_new_users" eval='1'/>
|
||||
<!-- Top Menu -->
|
||||
<field name="navbar_color">#EEEEF5</field>
|
||||
<field name="navbar_border_color">#BCE8F1</field>
|
||||
<field name="menu_font_color">#428BCA</field>
|
||||
<field name="navbar_active_item_font_color">#FFFFFF</field>
|
||||
<field name="menu_active_item_color">#428BCA</field>
|
||||
<field name="navbar_hover_font_color">#121212</field>
|
||||
<field name="navbar_hover_background_color">#FFFFFF</field>
|
||||
<!-- Left Menu -->
|
||||
<field name="left_bar_color">#F0F7FF</field>
|
||||
<field name="left_bar_category_font_color">#428BCA</field>
|
||||
<field name="left_bar_font_color">#777777</field>
|
||||
<field name="left_bar_active_item_font_color">#FFFFFF</field>
|
||||
<field name="left_bar_active_item_color">#428BCA</field>
|
||||
<field name="left_bar_hover_font_color">#121212</field>
|
||||
<field name="left_bar_hover_background_color">#FFFFFF</field>
|
||||
<!-- Header Section -->
|
||||
<field name='header_table_color'>#F0F7FF</field>
|
||||
<field name='header_table_color_2'>#EEEEF5</field>
|
||||
<!-- Footer -->
|
||||
<field name="footer_text">Inspired by IT Libertas</field>
|
||||
<field name="footer_url">https://itlibertas.com</field>
|
||||
<field name="footer_color">#31708F</field>
|
||||
<!--Image -->
|
||||
<field name="image" type="base64" file="colors_customization/static/src/img/itl_favicon.png"/>
|
||||
<field name="meta_title">ITL</field>
|
||||
</record>
|
||||
<!-- Froggy -->
|
||||
<record model="colors.customization.theme" id="custom_theme">
|
||||
<field name="name">Froggy</field>
|
||||
<field name="default_for_new_users" eval='0'/>
|
||||
<!-- Top Menu -->
|
||||
<field name="navbar_color">#DBDBDB</field>
|
||||
<field name="navbar_border_color">#9CA8A6</field>
|
||||
<field name="menu_font_color">#39CA64</field>
|
||||
<field name="navbar_active_item_font_color">#006629</field>
|
||||
<field name="menu_active_item_color">#FFFFFF</field>
|
||||
<field name="navbar_hover_font_color">#080808</field>
|
||||
<field name="navbar_hover_background_color">#DEFFAD</field>
|
||||
<!-- Left Menu -->
|
||||
<field name="left_bar_color">#DBDBDB</field>
|
||||
<field name="left_bar_category_font_color">#4BA816</field>
|
||||
<field name="left_bar_font_color">#39CA64</field>
|
||||
<field name="left_bar_active_item_font_color">#006629</field>
|
||||
<field name="left_bar_active_item_color">#FFFFFF</field>
|
||||
<field name="left_bar_hover_font_color">#080808</field>
|
||||
<field name="left_bar_hover_background_color">#DEFFAD</field>
|
||||
<!-- Header Section -->
|
||||
<field name='header_table_color'>#DBDBDB</field>
|
||||
<field name='header_table_color_2'>#B3C9B4</field>
|
||||
<!-- Footer -->
|
||||
<field name="footer_text">Inspired by IT Libertas</field>
|
||||
<field name="footer_url">https://itlibertas.com</field>
|
||||
<field name="footer_color">#006629</field>
|
||||
<!--Image -->
|
||||
<field name="image" type="base64" file="colors_customization/static/src/img/frog-favicon.png"/>
|
||||
<field name="meta_title">ITL</field>
|
||||
</record>
|
||||
<!-- POPPY -->
|
||||
<record model="colors.customization.theme" id="poppy_theme">
|
||||
<field name="name">Poppy</field>
|
||||
<field name="default_for_new_users" eval='0'/>
|
||||
<!-- Top Menu -->
|
||||
<field name="navbar_color">#DB0000</field>
|
||||
<field name="navbar_border_color">#A80000</field>
|
||||
<field name="navbar_active_item_font_color">#CABCBC</field>
|
||||
<field name="menu_font_color">#000000</field>
|
||||
<!-- Left Menu -->
|
||||
<field name="left_bar_color">#3B3B3B</field>
|
||||
<field name="left_bar_font_color">#DB0000</field>
|
||||
<field name="left_bar_category_font_color">#FF0000</field>
|
||||
<field name="left_bar_active_item_color">#000000</field>
|
||||
<!-- Footer -->
|
||||
<field name="footer_text">Inspired by IT Libertas</field>
|
||||
<field name="footer_url">https://itlibertas.com</field>
|
||||
<field name="footer_color">#A80000</field>
|
||||
<!--Image -->
|
||||
<field name="image" type="base64" file="colors_customization/static/src/img/poppy-favicon.png"/>
|
||||
<field name="meta_title">ITL</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -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
|
|
@ -0,0 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import custom_colors
|
||||
import res_company
|
||||
import configs
|
||||
import no_knock_odoo
|
||||
import mail
|
|
@ -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
|
|
@ -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'
|
||||
|
||||
|
||||
|
|
@ -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 = '<br />' + user.company_id.custom_email_footer
|
||||
if partner and partner.lang:
|
||||
signature_company = '<br />' + 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('<a style')
|
||||
index_end = link.find('</a>') +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 = "--<br />%s" % user.name
|
||||
footer = tools.append_content_to_html(footer, signature, plaintext=False)
|
||||
|
||||
return footer
|
||||
|
||||
mail_notification()
|
|
@ -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
|
|
@ -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')
|
|
@ -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
|
|
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 64 KiB |
|
@ -0,0 +1,15 @@
|
|||
|
||||
<section class="container">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<p class="mt32" style="font-size:18px">
|
||||
The module is not any more supported
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 236 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 42 KiB |
|
@ -0,0 +1,3 @@
|
|||
.oe_kanban_group_title_vertical {
|
||||
writing-mode: inherit ! important;
|
||||
}
|
After Width: | Height: | Size: 242 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 54 KiB |
|
@ -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});
|
||||
};
|
||||
|
||||
};
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
|
||||
|
||||
|
||||
});
|
||||
};
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates id="template" xml:space="preserve">
|
||||
<!--<t t-name="UserMenu.about" t-extend="UserMenu.about">
|
||||
<t t-jquery='div[class="col-sm-offset-2 col-md-offset-2 col-sm-8 col-md-8 user-details"]' t-operation="replace"/>
|
||||
</t>-->
|
||||
<t t-name="UserMenu" t-extend="UserMenu">
|
||||
<t t-jquery='a[data-menu="about"]' t-operation="replace">
|
||||
<a href="?debug" data-menu="about">Developer Mode</a>
|
||||
</t>
|
||||
</t>
|
||||
<t t-name="announcement_bar" t-extend="WebClient.announcement_bar" >
|
||||
<t t-jquery="td.announcement_bar" t-operation="replace">
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
|
@ -0,0 +1,107 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="colors_customization_tree_view" model="ir.ui.view">
|
||||
<field name="name">Themes</field>
|
||||
<field name="model">colors.customization.theme</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Themes" colors="blue:default_for_new_users==True">
|
||||
<field name="name"/>
|
||||
<field name='default_for_new_users'/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="colors_customization_form_view" model="ir.ui.view">
|
||||
<field name="name">Custom color theme</field>
|
||||
<field name="model">colors.customization.theme</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create color theme">
|
||||
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
<field name="name" default_focus="1" placeholder="Name" />
|
||||
</h1>
|
||||
<div groups='base.group_erp_manager'>
|
||||
<field name='default_for_new_users' class='oe_inline' options='{"no_create":True,"no_quick_create":True}'/>
|
||||
<label for='default_for_new_users'/>
|
||||
<field name='users' widget='many2many_tags' placeholder='Assign this theme to users'/>
|
||||
</div>
|
||||
</div>
|
||||
<div class='oe_right oe_button_box' name='buttons' groups='base.group_erp_manager'>
|
||||
<button class="oe_inline oe_stat_button" icon="fa-users" type="object" name="assign_to_all_users"
|
||||
help='Assign this theme to all users for all companies. Other themes would be used by any user after this operation'>
|
||||
<div>Assign to<br/>All users</div>
|
||||
</button>
|
||||
</div>
|
||||
<group>
|
||||
<group string='Top Panel'>
|
||||
<field name="navbar_color" widget="color"/>
|
||||
<field name="navbar_border_color" widget="color"/>
|
||||
<field name="menu_font_color" widget="color"/>
|
||||
<field name="navbar_active_item_font_color" widget="color"/>
|
||||
<field name="menu_active_item_color" widget="color"/>
|
||||
<field name="navbar_hover_font_color" widget="color"/>
|
||||
<field name="navbar_hover_background_color" widget="color"/>
|
||||
</group>
|
||||
<group string='Left Panel'>
|
||||
<field name="left_bar_color" widget="color"/>
|
||||
<field name="left_bar_category_font_color" widget="color"/>
|
||||
<field name="left_bar_font_color" widget="color"/>
|
||||
<field name="left_bar_active_item_font_color" widget="color"/>
|
||||
<field name="left_bar_active_item_color" widget="color"/>
|
||||
<field name="left_bar_hover_font_color" widget="color"/>
|
||||
<field name="left_bar_hover_background_color" widget="color"/>
|
||||
</group>
|
||||
<label for='header_table_color'/>
|
||||
<div >
|
||||
<field name='header_table_color' widget="color" class='oe_inline'/>
|
||||
-
|
||||
<field name='header_table_color_2' widget="color" class='oe_inline'/>
|
||||
</div>
|
||||
<field name="css" col='6' colspan='6' nolabel='1' invisible='1'/>
|
||||
<group string='Meta'>
|
||||
<field name='meta_title' placeholder='e.g. YourComp'/>
|
||||
</group>
|
||||
<group string='Footer'>
|
||||
<field name='footer_text' placeholder='Instead of standard Powered by..'/>
|
||||
<field name='footer_url' placeholder='http://yourcom.ex.com. HTTP or HTTPS are required!' attrs="{'invisible':['|',('footer_text','=',False),('footer_text','=','')]}"/>
|
||||
<field name="footer_color" widget="color" attrs="{'invisible':['|',('footer_text','=',False),('footer_text','=','')]}"/>
|
||||
</group>
|
||||
<group string='Favicon'>
|
||||
<div class='oe_left'>
|
||||
<field name="image" widget='image' class="oe_avatar" options='{"preview_image": "image_medium"}'/>
|
||||
</div>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
<notebook>
|
||||
<page string='User Menu' groups='base.group_erp_manager'>
|
||||
<group>
|
||||
<field name='remove_menu_preferences'/>
|
||||
<field name='remove_menu_about'/>
|
||||
<field name='remove_menu_account'/>
|
||||
<field name='remove_menu_help'/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
<div class='oe_clear'/>
|
||||
|
||||
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_colors_customization" model="ir.actions.act_window">
|
||||
<field name="name">Themes</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">colors.customization.theme</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="colors_customization_root" name="Interface" parent="base.menu_administration"/>
|
||||
|
||||
<menuitem id="colors_customization_config" name="Themes" parent="colors_customization.colors_customization_root" action="action_colors_customization" sequence="15" />
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<template id="custom_css" name="custom_css" inherit_id="web.layout">
|
||||
<xpath expr=".//head" position="inside">
|
||||
<link rel="stylesheet" href="/custom_colors" />
|
||||
<script type="text/javascript" src="/colors_customization/static/src/js/menu.js"></script>
|
||||
</xpath>
|
||||
<xpath expr="//title" position="replace">
|
||||
<t t-if="theme_data">
|
||||
<title t-if="theme_data and theme_data['meta_title']"><t t-esc="theme_data['meta_title']"/></title>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
<template id="menu_secondary" inherit_id="web.menu_secondary">
|
||||
<xpath expr="//div[@class='oe_footer']" position="replace">
|
||||
<div class='oe_footer'>
|
||||
<t t-if="theme_data">
|
||||
<a t-if="theme_data['footer_text'] and theme_data['footer_url'] and theme_data['footer_color']" t-att-href="theme_data['footer_url']" target="_blank"><span t-att-style="'color:'+theme_data['footer_color']"><t t-esc="theme_data['footer_text']"/></span></a>
|
||||
</t>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
<!-- Just remove since we do not have a company -->
|
||||
<template id="login_layout" inherit_id="web.login_layout" name="Login Layout">
|
||||
<xpath expr="//div[@class='oe_single_form_footer']" position="replace">
|
||||
<div class="oe_single_form_footer" t-if="not disable_footer">
|
||||
<t t-if="not disable_database_manager">
|
||||
<a class="oe_login_manage_db" t-attf-href="/web/database/manager{{ '?debug' if debug else '' }}">Manage Databases</a>
|
||||
<span t-if="theme_data" class="oe_footer_seperator"> | </span>
|
||||
</t>
|
||||
<t t-if="theme_data">
|
||||
<a t-if="theme_data['footer_url']" href="https://www.odoo.com" t-att-href="theme_data['footer_url']" target="_blank">
|
||||
<span><t t-esc="theme_data['footer_text']"/></span>
|
||||
</a>
|
||||
</t>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
<template id="web_layout" inherit_id="web.layout">
|
||||
<xpath expr="//link[@rel='shortcut icon']" position="replace">
|
||||
<t t-if="theme_data">
|
||||
<link t-if="theme_data['url_favicon']" rel="shortcut icon" t-att-href="theme_data['url_favicon']" type="image/x-icon"/>
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
<!-- Fix the problem of reverted kaban columns -->
|
||||
<template id="assets_frontend" inherit_id="web.assets_backend">
|
||||
<xpath expr="." position="inside">
|
||||
<link rel='stylesheet' href='/colors_customization/static/src/css/kanban.css'></link>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_interface_config" model="ir.ui.view">
|
||||
<field name="name">interface settings</field>
|
||||
<field name="model">interface.conf</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Interface Settings" class="oe_form_configuration">
|
||||
<header>
|
||||
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
|
||||
or
|
||||
<button string="Cancel" type="object" name="cancel" special='cancel' class="oe_link"/>
|
||||
</header>
|
||||
<div name="inter_settings_1">
|
||||
<separator string="User Preferences"/>
|
||||
<group>
|
||||
<field name='company_id' groups="base.group_multi_company"/>
|
||||
<field name='user_own_theme'/>
|
||||
</group>
|
||||
<separator string="Mail Customizations"/>
|
||||
<group>
|
||||
<field name="custom_email_footer" placeholder="Put here a text instead of standard 'Sent by.. using Odoo'. E.g. 'Sent by MyComp'. You may also use any HTML tags here like 'a','style' or 'href'. Leave it empty to remove the footer at all"/>
|
||||
<field name="footer_link" placeholder="Put here a text in a format 'TEXT * TEXT'. E.g. 'Access *' would be converted to 'Access Lead Super'. HTML tags are also of use. Leave it empty to remove the link at all"/>
|
||||
</group>
|
||||
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_interface_config" model="ir.actions.act_window">
|
||||
<field name="name">Settings</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">interface.conf</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">inline</field>
|
||||
</record>
|
||||
|
||||
|
||||
<menuitem id="interface_settings_config" name="Settings" parent="colors_customization.colors_customization_root" action="action_interface_config" sequence="25" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="mail.ir_cron_module_update_notification" model="ir.cron">
|
||||
<field name="name">Update Notification</field>
|
||||
<field eval="False" name="active" />
|
||||
<field name="user_id" ref="base.user_root" />
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">weeks</field>
|
||||
<field eval="False" name="doall" />
|
||||
<field eval="'publisher_warranty.contract'" name="model" />
|
||||
<field eval="'update_notification'" name="function" />
|
||||
<field eval="'(None,)'" name="args" />
|
||||
<field name="priority">1000</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,45 @@
|
|||
<openerp>
|
||||
<data>
|
||||
<record id="view_company_form" model="ir.ui.view">
|
||||
<field name="name">res.company.form</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<notebook position='inside'>
|
||||
<page string='Interface'>
|
||||
<group>
|
||||
<field name='user_own_theme'/>
|
||||
<field name='custom_email_footer'/>
|
||||
<field name='footer_link'/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<function model="res.groups" name="update_user_groups_view" />
|
||||
<record id="view_users_form_theme_simple" model="ir.ui.view">
|
||||
<field name="name">res.users.preferences.theme</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form_simple_modif"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='company_id']" position="before">
|
||||
<field name="company_color_theme" readonly="0" options='{"no_create":True,"no_quick_create":True}' attrs="{'invisible':[('user_own_theme','=',False)]}"/>
|
||||
<field name='user_own_theme' invisible='1'/>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_users_form_theme" model="ir.ui.view">
|
||||
<field name="name">res.users.theme</field>
|
||||
<field name="model">res.users</field>
|
||||
<field name="inherit_id" ref="base.view_users_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="tz" position="after">
|
||||
<field name="company_color_theme" readonly="0" options='{"no_create":True,"no_quick_create":True}'/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1 @@
|
|||
# -*- coding: utf-8 -*-
|