mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
add set system icon
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import models
|
||||
|
||||
from . import models
|
||||
from . import controllers
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ You can config odoo, make it look like your own platform.
|
||||
15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...
|
||||
16. Fix odoo reload module translation bug while enable english language
|
||||
17. Stop Odoo Auto Subscribe(Performance Improve)
|
||||
18. Show/Hide Author and Website in Apps Dashboard (odoo 11 only)
|
||||
19. Set System Icon (odoo 10 only)
|
||||
|
||||
This module can help to white label the Odoo.
|
||||
Also helpful for training and support for your odoo end-user.
|
||||
@@ -57,8 +59,11 @@ The user can get the help document just by one click.
|
||||
'data': [
|
||||
'views/app_odoo_customize_view.xml',
|
||||
'views/app_theme_config_settings_view.xml',
|
||||
'views/res_company_view.xml',
|
||||
'views/templates.xml',
|
||||
# data
|
||||
'data/ir_config_parameter.xml',
|
||||
'data/res_company_data.xml',
|
||||
],
|
||||
'demo': [],
|
||||
'test': [
|
||||
|
||||
3
app_odoo_customize/controllers/__init__.py
Normal file
3
app_odoo_customize/controllers/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import web_favicon
|
||||
42
app_odoo_customize/controllers/web_favicon.py
Normal file
42
app_odoo_customize/controllers/web_favicon.py
Normal file
@@ -0,0 +1,42 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Created on 2018-04-11
|
||||
# author: 广州尚鹏,http://www.sunpop.cn
|
||||
# email: 300883@qq.com
|
||||
# resource of Sunpop
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
# Odoo在线中文用户手册(长期更新)
|
||||
# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
|
||||
|
||||
# Odoo10离线中文用户手册下载
|
||||
# http://www.sunpop.cn/odoo10_user_manual_document_offline/
|
||||
# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备)
|
||||
# http://www.sunpop.cn/odoo10_developer_document_offline/
|
||||
# description:
|
||||
|
||||
import StringIO
|
||||
import base64
|
||||
from odoo import http
|
||||
from odoo.tools.misc import file_open
|
||||
|
||||
|
||||
class WebFavicon(http.Controller):
|
||||
|
||||
@http.route('/web_favicon/favicon', type='http', auth="none")
|
||||
def icon(self):
|
||||
request = http.request
|
||||
if 'uid' in request.env.context:
|
||||
user = request.env['res.users'].browse(request.env.context['uid'])
|
||||
company = user.sudo(user.id).company_id
|
||||
else:
|
||||
company = request.env['res.company'].search([], limit=1)
|
||||
favicon = company.favicon_backend
|
||||
favicon_mimetype = company.favicon_backend_mimetype
|
||||
if not favicon:
|
||||
favicon = file_open('web/static/src/img/favicon.ico')
|
||||
favicon_mimetype = 'image/x-icon'
|
||||
else:
|
||||
favicon = StringIO.StringIO(base64.b64decode(favicon))
|
||||
return request.make_response(
|
||||
favicon.read(), [('Content-Type', favicon_mimetype)])
|
||||
9
app_odoo_customize/data/res_company_data.xml
Normal file
9
app_odoo_customize/data/res_company_data.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
<record id="base.main_company" model="res.company">
|
||||
<field name="favicon_backend_mimetype">image/png</field>
|
||||
<field name="image" type="base64" file="app_odoo_customize/static/src/img/icon76red.png"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -4,3 +4,4 @@ import ir_ui_view
|
||||
import app_theme_config_settings
|
||||
import base_language_install
|
||||
import mail_thread
|
||||
import res_company
|
||||
|
||||
@@ -32,6 +32,15 @@ class AppThemeConfigSettings(models.TransientModel):
|
||||
app_account_title = fields.Char('My Odoo.com Account Title')
|
||||
app_account_url = fields.Char('My Odoo.com Account Url')
|
||||
|
||||
company_id = fields.Many2one(
|
||||
'res.company', 'Company',
|
||||
default=lambda self: self.env.user.company_id, required=True)
|
||||
app_favicon_backend = fields.Binary(related='company_id.favicon_backend', string="Favicon backend")
|
||||
app_favicon_backend_mimetype = fields.Selection(
|
||||
related='company_id.favicon_backend_mimetype',
|
||||
string='Favicon mimetype',
|
||||
help='Set the mimetype of your file.')
|
||||
|
||||
@api.model
|
||||
def get_default_all(self, fields):
|
||||
ir_config = self.env['ir.config_parameter']
|
||||
@@ -72,7 +81,10 @@ class AppThemeConfigSettings(models.TransientModel):
|
||||
app_documentation_dev_url=app_documentation_dev_url,
|
||||
app_support_url=app_support_url,
|
||||
app_account_title=app_account_title,
|
||||
app_account_url=app_account_url
|
||||
app_account_url=app_account_url,
|
||||
company_id=self.env.user.company_id.id,
|
||||
app_favicon_backend=self.env.user.company_id.favicon_backend,
|
||||
app_favicon_backend_mimetype=self.env.user.company_id.favicon_backend_mimetype,
|
||||
)
|
||||
|
||||
@api.multi
|
||||
|
||||
29
app_odoo_customize/models/res_company.py
Normal file
29
app_odoo_customize/models/res_company.py
Normal file
@@ -0,0 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Created on 2018-04-11
|
||||
# author: 广州尚鹏,http://www.sunpop.cn
|
||||
# email: 300883@qq.com
|
||||
# resource of Sunpop
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
# Odoo在线中文用户手册(长期更新)
|
||||
# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
|
||||
|
||||
# Odoo10离线中文用户手册下载
|
||||
# http://www.sunpop.cn/odoo10_user_manual_document_offline/
|
||||
# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备)
|
||||
# http://www.sunpop.cn/odoo10_developer_document_offline/
|
||||
# description:
|
||||
|
||||
from openerp import api, fields, models, _
|
||||
|
||||
class ResCompany(models.Model):
|
||||
_inherit = 'res.company'
|
||||
|
||||
favicon_backend = fields.Binary(string="Favicon backend")
|
||||
favicon_backend_mimetype = fields.Selection(
|
||||
selection=[('image/x-icon', 'image/x-icon'),
|
||||
('image/gif', 'image/gif'),
|
||||
('image/png', 'image/png')],
|
||||
string='Favicon mimetype',
|
||||
help='Set the mimetype of your file.')
|
||||
@@ -5,11 +5,14 @@
|
||||
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
||||
<p>This moduld allows user to quickly customize and debranding Odoo. Quick debug, Language Switcher,
|
||||
Online Documentation Access,Quick Data Clear. </p>
|
||||
<h3>Lastest update: v11.0.3.23</h3>
|
||||
<p>Add 18. Show/Hide Author and Website in Apps Dashboard</p>
|
||||
<p>Fix some bug.</p>
|
||||
<h1>More Powerful UI addons:
|
||||
<a class="btn btn-primary mb16" href="https://www.odoo.com/apps/modules/10.0/app_ui_enhance/">App UI enhance</a>
|
||||
</h1>
|
||||
<br>
|
||||
<h3>Lastest update: v10.0.2.4, 2018-02-04</h3>
|
||||
<h3>Add Odoo 11 Support</h3>
|
||||
<ul>
|
||||
<li>1. Deletes Odoo label in footer</li>
|
||||
<li>2. Replaces "Odoo" in Windows title</li>
|
||||
@@ -28,6 +31,8 @@
|
||||
<li>15. Reset All the Sequence to beginning of 1: SO/PO/MO/Invoice...</li>
|
||||
<li>16. Fix odoo reload module translation bug while enable english language</li>
|
||||
<li>17. Stop Odoo Auto Subscribe(Performance Improve)</li>
|
||||
<li>18. Show/Hide Author and Website in Apps Dashboard (odoo 11 only)</li>
|
||||
<li>19. Set System Icon (odoo 10 only)</li>
|
||||
</ul>
|
||||
<p>
|
||||
This module can help to white label the Odoo.
|
||||
@@ -78,6 +83,34 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oe_row oe_spaced" style="max-width: 800px;">
|
||||
<div class="oe_demo"
|
||||
style="margin: 20px auto; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%; ">
|
||||
<h2 class='oe_mt32'>Set System Icon (odoo 10 only)</h2>
|
||||
</div>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="set19.jpg" style="border:1px solid black"/>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oe_row oe_spaced" style="max-width: 800px;">
|
||||
<div class="oe_demo"
|
||||
style="margin: 20px auto; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%;">
|
||||
<h2 class='oe_mt32'>Show/Hide Author and Website in Apps Dashboard</h2>
|
||||
</div>
|
||||
<p>Before</p>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="set18-1.jpg" style="border:1px solid black"/>
|
||||
<br/>
|
||||
</div>
|
||||
<p>After uncheck "Show Author and Website in Apps Dashboard"</p>
|
||||
<div class="oe_demo oe_screenshot">
|
||||
<img src="set18-2.jpg" style="border:1px solid black"/>
|
||||
<br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oe_row oe_spaced" style="max-width: 800px;">
|
||||
<div class="oe_demo"
|
||||
style="margin: 20px auto; padding: 0 15px 0 0; border:none; border-top:solid 1px #dedede; width: 96%;">
|
||||
|
||||
BIN
app_odoo_customize/static/description/set18-1.jpg
Normal file
BIN
app_odoo_customize/static/description/set18-1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
BIN
app_odoo_customize/static/description/set18-2.jpg
Normal file
BIN
app_odoo_customize/static/description/set18-2.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 42 KiB |
BIN
app_odoo_customize/static/description/set19.jpg
Normal file
BIN
app_odoo_customize/static/description/set19.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.1 KiB |
BIN
app_odoo_customize/static/src/img/icon76red.png
Normal file
BIN
app_odoo_customize/static/src/img/icon76red.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
@@ -88,6 +88,16 @@
|
||||
<field name="app_account_url"/>
|
||||
</div>
|
||||
</group>
|
||||
<group string="System Icon">
|
||||
<label for="app_favicon_backend"/>
|
||||
<div>
|
||||
<field name="app_favicon_backend" widget="image"/>
|
||||
</div>
|
||||
<label for="app_favicon_backend_mimetype"/>
|
||||
<div>
|
||||
<field name="app_favicon_backend_mimetype" attrs="{'required': [('app_favicon_backend', '!=', False)]}" />
|
||||
</div>
|
||||
</group>
|
||||
<group name="data-clean" string="Data Cleaning (Be careful to do that!)">
|
||||
<label string="Sales"/>
|
||||
<div>
|
||||
|
||||
17
app_odoo_customize/views/res_company_view.xml
Normal file
17
app_odoo_customize/views/res_company_view.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record id="app_view_company_form" model="ir.ui.view">
|
||||
<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="Web Favicon" name="favicon" groups="base.group_system">
|
||||
<group string="Favicon" name="favicon">
|
||||
<field name="favicon_backend" widget="image" />
|
||||
<field name="favicon_backend_mimetype" attrs="{'required': [('favicon_backend', '!=', False)]}" />
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
8
app_odoo_customize/views/templates.xml
Normal file
8
app_odoo_customize/views/templates.xml
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<template id="layout" inherit_id="web.layout">
|
||||
<xpath expr="//link[@rel='shortcut icon']" position="replace">
|
||||
<link rel="icon" href="/web_favicon/favicon" />
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user