mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update customize
This commit is contained in:
@@ -23,17 +23,65 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'odoo 15 Customize OEM(Boost, Data reset)',
|
'name': 'odoo 15 Customize OEM(Boost, Data reset)',
|
||||||
'version': '15.21.10.07',
|
'version': '15.21.10.08',
|
||||||
'author': 'Sunpop.cn',
|
'author': 'Sunpop.cn',
|
||||||
'category': 'Productivity',
|
'category': 'Productivity',
|
||||||
'website': 'https://www.sunpop.cn',
|
'website': 'https://www.sunpop.cn',
|
||||||
'license': 'LGPL-3',
|
'license': 'LGPL-3',
|
||||||
'sequence': 2,
|
'sequence': 2,
|
||||||
|
'images': ['static/description/banner.gif'],
|
||||||
'summary': """
|
'summary': """
|
||||||
1 click customize odoo, reset data. For quick develop. Set brand, boost, reset data, debug. Language Switcher.
|
1 click customize odoo, reset data. For quick develop. Set brand, boost, reset data, debug. Language Switcher.
|
||||||
Easy Delete data.reset account chart.
|
Easy Delete data.reset account chart.
|
||||||
customize my odoo.
|
customize my odoo.
|
||||||
""",
|
""",
|
||||||
|
'depends': [
|
||||||
|
'base_setup',
|
||||||
|
'web',
|
||||||
|
'mail',
|
||||||
|
'iap',
|
||||||
|
# 'digest',
|
||||||
|
# when enterprise
|
||||||
|
# 'web_mobile'
|
||||||
|
],
|
||||||
|
'data': [
|
||||||
|
'security/res_groups.xml',
|
||||||
|
'security/ir.model.access.csv',
|
||||||
|
'views/app_odoo_customize_views.xml',
|
||||||
|
'views/app_theme_config_settings_views.xml',
|
||||||
|
'views/res_config_settings_views.xml',
|
||||||
|
'views/ir_views.xml',
|
||||||
|
'views/ir_module_module_views.xml',
|
||||||
|
'views/ir_translation_views.xml',
|
||||||
|
'views/ir_ui_menu_views.xml',
|
||||||
|
'views/ir_ui_view_views.xml',
|
||||||
|
'views/ir_model_fields_views.xml',
|
||||||
|
'views/ir_model_data_views.xml',
|
||||||
|
# data
|
||||||
|
'data/ir_config_parameter_data.xml',
|
||||||
|
'data/ir_module_module_data.xml',
|
||||||
|
# 'data/digest_template_data.xml',
|
||||||
|
'data/res_company_data.xml',
|
||||||
|
],
|
||||||
|
# 'qweb': [
|
||||||
|
# 'static/src/xml/*.xml',
|
||||||
|
# ],
|
||||||
|
'assets': {
|
||||||
|
'web.assets_backend': [
|
||||||
|
'app_odoo_customize/static/src/scss/app.scss',
|
||||||
|
'app_odoo_customize/static/src/scss/ribbon.scss',
|
||||||
|
'app_odoo_customize/static/src/scss/dialog.scss',
|
||||||
|
'app_odoo_customize/static/src/js/app_window_title.js',
|
||||||
|
'app_odoo_customize/static/src/js/user_menu.js',
|
||||||
|
# 'app_odoo_customize/static/src/js/ribbon.js',
|
||||||
|
'app_odoo_customize/static/src/js/dialog.js',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
'pre_init_hook': 'pre_init_hook',
|
||||||
|
'post_init_hook': 'post_init_hook',
|
||||||
|
'installable': True,
|
||||||
|
'application': True,
|
||||||
|
'auto_install': True,
|
||||||
'description': """
|
'description': """
|
||||||
|
|
||||||
App Customize Odoo (Change Title,Language,Documentation,Quick Debug)
|
App Customize Odoo (Change Title,Language,Documentation,Quick Debug)
|
||||||
@@ -128,52 +176,4 @@
|
|||||||
38. 对话框可拖拽
|
38. 对话框可拖拽
|
||||||
39. 只有系统管理员可以操作快速debug
|
39. 只有系统管理员可以操作快速debug
|
||||||
""",
|
""",
|
||||||
'images': ['static/description/banner.gif'],
|
|
||||||
'depends': [
|
|
||||||
'base_setup',
|
|
||||||
'web',
|
|
||||||
'mail',
|
|
||||||
'iap',
|
|
||||||
# 'digest',
|
|
||||||
# when enterprise
|
|
||||||
# 'web_mobile'
|
|
||||||
],
|
|
||||||
'data': [
|
|
||||||
'security/res_groups.xml',
|
|
||||||
'security/ir.model.access.csv',
|
|
||||||
'views/app_odoo_customize_views.xml',
|
|
||||||
'views/app_theme_config_settings_views.xml',
|
|
||||||
'views/res_config_settings_views.xml',
|
|
||||||
'views/ir_views.xml',
|
|
||||||
'views/ir_module_module_views.xml',
|
|
||||||
'views/ir_translation_views.xml',
|
|
||||||
'views/ir_ui_menu_views.xml',
|
|
||||||
'views/ir_ui_view_views.xml',
|
|
||||||
'views/ir_model_fields_views.xml',
|
|
||||||
'views/ir_model_data_views.xml',
|
|
||||||
# data
|
|
||||||
'data/ir_config_parameter_data.xml',
|
|
||||||
'data/ir_module_module_data.xml',
|
|
||||||
# 'data/digest_template_data.xml',
|
|
||||||
'data/res_company_data.xml',
|
|
||||||
],
|
|
||||||
'qweb': [
|
|
||||||
'static/src/xml/*.xml',
|
|
||||||
],
|
|
||||||
'assets': {
|
|
||||||
'web.assets_backend': [
|
|
||||||
'app_odoo_customize/static/src/scss/app.scss',
|
|
||||||
'app_odoo_customize/static/src/scss/ribbon.scss',
|
|
||||||
'app_odoo_customize/static/src/scss/dialog.scss',
|
|
||||||
'app_odoo_customize/static/src/js/app_window_title.js',
|
|
||||||
'app_odoo_customize/static/src/js/customize_user_menu.js',
|
|
||||||
'app_odoo_customize/static/src/js/ribbon.js',
|
|
||||||
'app_odoo_customize/static/src/js/dialog.js',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'pre_init_hook': 'pre_init_hook',
|
|
||||||
'post_init_hook': 'post_init_hook',
|
|
||||||
'installable': True,
|
|
||||||
'application': True,
|
|
||||||
'auto_install': True,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<function model="ir.config_parameter" name="set_param" eval="('app_support_url', 'https://www.sunpop.cn/trial')"/>
|
<function model="ir.config_parameter" name="set_param" eval="('app_support_url', 'https://www.sunpop.cn/trial')"/>
|
||||||
<function model="ir.config_parameter" name="set_param" eval="('app_account_title', 'My Online Account')"/>
|
<function model="ir.config_parameter" name="set_param" eval="('app_account_title', 'My Online Account')"/>
|
||||||
<function model="ir.config_parameter" name="set_param" eval="('app_account_url', 'https://www.sunpop.cn/my-account')"/>
|
<function model="ir.config_parameter" name="set_param" eval="('app_account_url', 'https://www.sunpop.cn/my-account')"/>
|
||||||
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_name', 'Sunpop.cn')"/>
|
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_name', 'Sunpop.cn({db_name})')"/>
|
||||||
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_color', '#f0f0f0')"/>
|
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_color', '#f0f0f0')"/>
|
||||||
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_background_color', 'rgba(255,0,0,.4)')"/>
|
<function model="ir.config_parameter" name="set_param" eval="('app_ribbon_background_color', 'rgba(255,0,0,.4)')"/>
|
||||||
</data>
|
</data>
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from . import res_config_settings
|
from . import res_config_settings
|
||||||
from . import ir_ui_view
|
|
||||||
from . import base_language_install
|
from . import base_language_install
|
||||||
from . import ir_module_module
|
from . import ir_module_module
|
||||||
from . import web_environment_ribbon_backend
|
from . import web_environment_ribbon_backend
|
||||||
|
from . import ir_http
|
||||||
|
# from . import ir_ui_view
|
||||||
# from . import ir_ui_menu
|
# from . import ir_ui_menu
|
||||||
|
|||||||
27
app_odoo_customize/models/ir_http.py
Normal file
27
app_odoo_customize/models/ir_http.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
|
|
||||||
|
from odoo import models
|
||||||
|
from odoo.http import request
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class IrHttp(models.AbstractModel):
|
||||||
|
_inherit = 'ir.http'
|
||||||
|
|
||||||
|
def session_info(self):
|
||||||
|
result = super(IrHttp, self).session_info()
|
||||||
|
config_parameter = request.env['ir.config_parameter'].sudo()
|
||||||
|
result['app_system_name'] = config_parameter.get_param('app_system_name', 'odooApp')
|
||||||
|
result['app_documentation_url'] = config_parameter.get_param('app_documentation_url')
|
||||||
|
result['app_documentation_dev_url'] = config_parameter.get_param('app_documentation_dev_url')
|
||||||
|
result['app_support_url'] = config_parameter.get_param('app_support_url')
|
||||||
|
result['app_account_title'] = config_parameter.get_param('app_account_title')
|
||||||
|
result['app_account_url'] = config_parameter.get_param('app_account_url')
|
||||||
|
result['app_show_documentation'] = config_parameter.get_param('app_show_documentation')
|
||||||
|
result['app_show_documentation_dev'] = config_parameter.get_param('app_show_documentation_dev')
|
||||||
|
result['app_show_support'] = config_parameter.get_param('app_show_support')
|
||||||
|
result['app_show_account'] = config_parameter.get_param('app_show_account')
|
||||||
|
result['app_show_poweredby'] = config_parameter.get_param('app_show_poweredby')
|
||||||
|
return result
|
||||||
@@ -46,7 +46,7 @@ class IrModule(models.Model):
|
|||||||
})
|
})
|
||||||
return action
|
return action
|
||||||
|
|
||||||
@api.depends('name', 'state')
|
@api.depends('name', 'latest_version', 'state')
|
||||||
def _get_latest_version(self):
|
def _get_latest_version(self):
|
||||||
default_version = modules.adapt_version('1.0')
|
default_version = modules.adapt_version('1.0')
|
||||||
for module in self:
|
for module in self:
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ _logger = logging.getLogger(__name__)
|
|||||||
class View(models.Model):
|
class View(models.Model):
|
||||||
_inherit = 'ir.ui.view'
|
_inherit = 'ir.ui.view'
|
||||||
|
|
||||||
@api.model
|
def _render_template(self, template, values=None, engine='ir.qweb'):
|
||||||
def render_template(self, template, values=None, engine='ir.qweb'):
|
# if template in ['web.login', 'web.webclient_bootstrap']:
|
||||||
if template in ['web.login', 'web.webclient_bootstrap']:
|
if not values:
|
||||||
if not values:
|
values = {}
|
||||||
values = {}
|
values["title"] = values["app_title"] = self.env['ir.config_parameter'].sudo().get_param("app_system_name", "odooApp")
|
||||||
values["title"] = self.env['ir.config_parameter'].sudo().get_param("app_system_name", "odooApp")
|
return super(View, self)._render_template(template, values=values, engine=engine)
|
||||||
return super(View, self).render_template(template, values=values, engine=engine)
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
|
from odoo.exceptions import UserError, ValidationError
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
odoo.define('app_odoo_customize.app_system_name', function (require) {
|
/** @odoo-module **/
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var WebClient = require('web.WebClient');
|
import { WebClient } from "@web/webclient/webclient";
|
||||||
WebClient.include({
|
import { patch } from "@web/core/utils/patch";
|
||||||
init: function() {
|
import { session } from "@web/session";
|
||||||
|
|
||||||
|
patch(WebClient.prototype, "app_odoo_customize.WebClient", {
|
||||||
|
setup() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this.set('title_part', {"zopenerp": document.title});
|
const app_system_name = session.app_system_name || 'odooApp';
|
||||||
|
this.title.setParts({ zopenerp: app_system_name }); // zopenerp is easy to grep
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
@@ -1,17 +1,23 @@
|
|||||||
odoo.define('app_odoo_customize.dialog', function (require) {
|
/** @odoo-module **/
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var Dialog = require('web.Dialog');
|
import { Dialog } from "@web/core/dialog/dialog";
|
||||||
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
import { session } from "@web/session";
|
||||||
|
|
||||||
Dialog.include({
|
patch(Dialog.prototype, "app_odoo_customize.Dialog", {
|
||||||
open: function () {
|
setup() {
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
this._opened.then(function(){
|
const app_system_name = session.app_system_name || "odooApp";
|
||||||
$(".modal-content").draggable({
|
this.title = app_system_name;
|
||||||
handle: ".modal-header"
|
},
|
||||||
});
|
// mounted() {
|
||||||
});
|
// //todo: 没用,不能用 jq的处理方式
|
||||||
return this;
|
// this._super.apply(this, arguments);
|
||||||
},
|
// var $dl = this.__owl__.vnode ? this.__owl__.vnode.elm : null;
|
||||||
});
|
// var $ml = $dl.children[0].children[0].children[0];
|
||||||
|
// $ml.draggable({
|
||||||
|
// handle: ".modal-header"
|
||||||
|
// });
|
||||||
|
// },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
116
app_odoo_customize/static/src/js/user_menu.js
Normal file
116
app_odoo_customize/static/src/js/user_menu.js
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
/** @odoo-module **/
|
||||||
|
|
||||||
|
import { UserMenu } from "@web/webclient/user_menu/user_menu";
|
||||||
|
import { routeToUrl } from "@web/core/browser/router_service";
|
||||||
|
import { patch } from "@web/core/utils/patch";
|
||||||
|
import { browser } from "@web/core/browser/browser";
|
||||||
|
import { registry } from "@web/core/registry";
|
||||||
|
import { session } from "@web/session";
|
||||||
|
const userMenuRegistry = registry.category("user_menuitems");
|
||||||
|
|
||||||
|
patch(UserMenu.prototype, "app_odoo_customize.UserMenu", {
|
||||||
|
setup() {
|
||||||
|
this._super.apply(this, arguments);
|
||||||
|
userMenuRegistry.remove("documentation");
|
||||||
|
userMenuRegistry.remove("support");
|
||||||
|
userMenuRegistry.remove("odoo_account");
|
||||||
|
userMenuRegistry.add("debug", debugItem)
|
||||||
|
.add("asset_asset", activateAssetsDebugging)
|
||||||
|
.add("leave_debug", leaveDebugMode)
|
||||||
|
.add("separator0", separator8)
|
||||||
|
.add("documentation", documentationItem)
|
||||||
|
.add("support", supportItem)
|
||||||
|
.add("odoo_account", odooAccountItem);
|
||||||
|
},
|
||||||
|
// getElements() {
|
||||||
|
// var ret = this._super.apply(this, arguments);
|
||||||
|
// return ret;
|
||||||
|
// },
|
||||||
|
});
|
||||||
|
|
||||||
|
function debugItem(env) {
|
||||||
|
const url_debug = $.param.querystring(window.location.href, 'debug=1');
|
||||||
|
return {
|
||||||
|
type: "item",
|
||||||
|
id: "debug",
|
||||||
|
description: env._t("Activate the developer mode"),
|
||||||
|
href: url_debug,
|
||||||
|
callback: () => {
|
||||||
|
browser.open(url_debug, "_self");
|
||||||
|
},
|
||||||
|
sequence: 5,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function activateAssetsDebugging(env) {
|
||||||
|
return {
|
||||||
|
type: "item",
|
||||||
|
description: env._t("Activate Assets Debugging"),
|
||||||
|
callback: () => {
|
||||||
|
browser.location.search = "?debug=assets";
|
||||||
|
},
|
||||||
|
sequence: 6,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function leaveDebugMode(env) {
|
||||||
|
return {
|
||||||
|
type: "item",
|
||||||
|
description: env._t("Leave the Developer Tools"),
|
||||||
|
callback: () => {
|
||||||
|
const route = env.services.router.current;
|
||||||
|
route.search.debug = "";
|
||||||
|
browser.location.href = browser.location.origin + routeToUrl(route);
|
||||||
|
},
|
||||||
|
sequence: 7,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function separator8() {
|
||||||
|
return {
|
||||||
|
type: "separator",
|
||||||
|
sequence: 8,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
function documentationItem(env) {
|
||||||
|
const documentationURL = session.app_documentation_url;
|
||||||
|
return {
|
||||||
|
type: "item",
|
||||||
|
id: "documentation",
|
||||||
|
description: env._t("Documentation"),
|
||||||
|
href: documentationURL,
|
||||||
|
callback: () => {
|
||||||
|
browser.open(documentationURL, "_blank");
|
||||||
|
},
|
||||||
|
sequence: 10,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function supportItem(env) {
|
||||||
|
const url = session.app_support_url;
|
||||||
|
return {
|
||||||
|
type: "item",
|
||||||
|
id: "support",
|
||||||
|
description: env._t("Support"),
|
||||||
|
href: url,
|
||||||
|
callback: () => {
|
||||||
|
browser.open(url, "_blank");
|
||||||
|
},
|
||||||
|
sequence: 20,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function odooAccountItem(env) {
|
||||||
|
const app_account_title = session.app_account_title;
|
||||||
|
const app_account_url = session.app_account_url;
|
||||||
|
return {
|
||||||
|
type: "item",
|
||||||
|
id: "account",
|
||||||
|
description: env._t(app_account_title),
|
||||||
|
href: app_account_url,
|
||||||
|
callback: () => {
|
||||||
|
browser.open(app_account_url, "_blank");
|
||||||
|
},
|
||||||
|
sequence: 60,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<templates xml:space="preserve">
|
<templates xml:space="preserve">
|
||||||
<t t-extend="UserMenu.Actions">
|
<!--owl 处理继承继承-->
|
||||||
|
<t t-name="UserMenu" t-inherit="web.UserMenu" t-inherit-mode="extension" owl="1">
|
||||||
|
<xpath expr="//td[hasclass('client-line-email')]" position="after">
|
||||||
<t t-jquery="a[data-menu='documentation']" t-operation="before">
|
<t t-jquery="a[data-menu='documentation']" t-operation="before">
|
||||||
<switch-lang/>
|
<switch-lang/>
|
||||||
<a role="menuitem" href="#" data-menu="debug" class="dropdown-item">Activate the developer mode</a>
|
<a role="menuitem" href="#" data-menu="debug" class="dropdown-item">Activate the developer mode</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user