mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
Merge branch '13.0' of https://github.com/guohuadeng/app-odoo into 13.0
This commit is contained in:
@@ -23,7 +23,7 @@
|
||||
|
||||
{
|
||||
'name': 'Odoo Customize(Debranding, My Odoo)',
|
||||
'version': '13.19.05.30',
|
||||
'version': '13.19.09.14',
|
||||
'author': 'Sunpop.cn',
|
||||
'category': 'Productivity',
|
||||
'website': 'https://www.sunpop.cn',
|
||||
@@ -77,7 +77,6 @@
|
||||
'base',
|
||||
'web',
|
||||
'mail',
|
||||
'web_settings_dashboard',
|
||||
'iap',
|
||||
# 'digest',
|
||||
# when enterprise
|
||||
|
||||
@@ -4,4 +4,5 @@ from . import res_config_settings
|
||||
from . import ir_ui_view
|
||||
from . import base_language_install
|
||||
from . import models
|
||||
# from . import ir_ui_menu
|
||||
# from . import mail_thread
|
||||
|
||||
@@ -8,7 +8,6 @@ from odoo import api, fields, models, _
|
||||
class BaseLanguageInstall(models.TransientModel):
|
||||
_inherit = "base.language.install"
|
||||
|
||||
@api.multi
|
||||
def lang_install(self):
|
||||
self.ensure_one()
|
||||
if self.overwrite:
|
||||
|
||||
26
app_odoo_customize/models/ir_ui_menu.py
Normal file
26
app_odoo_customize/models/ir_ui_menu.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import re
|
||||
|
||||
from odoo import api, fields, models, tools, _
|
||||
|
||||
MENU_ITEM_SEPARATOR = "/"
|
||||
NUMBER_PARENS = re.compile(r"\(([0-9]+)\)")
|
||||
|
||||
|
||||
class IrUiMenu(models.Model):
|
||||
_inherit = 'ir.ui.menu'
|
||||
|
||||
def _get_full_name(self, level=6):
|
||||
""" Return the full name of ``self`` (up to a certain level). """
|
||||
if level <= 0:
|
||||
return '...'
|
||||
if self.parent_id:
|
||||
try:
|
||||
name = self.parent_id._get_full_name(level - 1) + MENU_ITEM_SEPARATOR + (self.name or "")
|
||||
except Exception:
|
||||
name = self.name or "..."
|
||||
else:
|
||||
name = self.name
|
||||
return name
|
||||
|
||||
@@ -8,7 +8,6 @@ from odoo import api, fields, models, _
|
||||
class MailThread(models.AbstractModel):
|
||||
_inherit = "mail.thread"
|
||||
|
||||
@api.multi
|
||||
def message_subscribe(self, partner_ids=None, channel_ids=None, subtype_ids=None, force=True):
|
||||
""" 停用订阅功能. """
|
||||
ir_config = self.env['ir.config_parameter']
|
||||
@@ -18,7 +17,6 @@ class MailThread(models.AbstractModel):
|
||||
else:
|
||||
return super(MailThread, self).message_subscribe(partner_ids, channel_ids, subtype_ids, force)
|
||||
|
||||
@api.multi
|
||||
def message_auto_subscribe(self, updated_fields, values=None):
|
||||
""" 停用订阅功能. """
|
||||
ir_config = self.env['ir.config_parameter']
|
||||
@@ -28,7 +26,6 @@ class MailThread(models.AbstractModel):
|
||||
else:
|
||||
return super(MailThread, self).message_auto_subscribe(updated_fields, values)
|
||||
|
||||
@api.multi
|
||||
def _message_auto_subscribe_notify(self, partner_ids):
|
||||
""" 停用订阅功能. """
|
||||
ir_config = self.env['ir.config_parameter']
|
||||
|
||||
@@ -6,7 +6,6 @@ from odoo import models, fields, api
|
||||
class Module(models.Model):
|
||||
_inherit = 'ir.module.module'
|
||||
|
||||
@api.multi
|
||||
def module_multi_uninstall(self):
|
||||
""" Perform the various steps required to uninstall a module completely
|
||||
including the deletion of all database structures created by the module:
|
||||
|
||||
@@ -80,7 +80,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def set_values(self):
|
||||
super(ResConfigSettings, self).set_values()
|
||||
ir_config = self.env['ir.config_parameter'].sudo()
|
||||
@@ -183,7 +182,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_pos(self):
|
||||
to_removes = [
|
||||
# 清除POS单据
|
||||
@@ -203,11 +201,15 @@ class ResConfigSettings(models.TransientModel):
|
||||
seq.write({
|
||||
'number_next': 1,
|
||||
})
|
||||
# 更新要关帐的值,因为 store=true 的计算字段要重置
|
||||
statement = self.env['account.bank.statement'].search([])
|
||||
for s in statement:
|
||||
s._end_balance()
|
||||
|
||||
except Exception as e:
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_purchase(self):
|
||||
to_removes = [
|
||||
# 清除采购单据
|
||||
@@ -237,7 +239,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_expense(self):
|
||||
to_removes = [
|
||||
# 清除采购单据
|
||||
@@ -263,7 +264,33 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_expense(self):
|
||||
to_removes = [
|
||||
# 清除
|
||||
['hr.expense.sheet', ],
|
||||
['hr.expense', ],
|
||||
['hr.payslip', ],
|
||||
['hr.payslip.run', ],
|
||||
]
|
||||
try:
|
||||
for line in to_removes:
|
||||
obj_name = line[0]
|
||||
obj = self.pool.get(obj_name)
|
||||
if obj:
|
||||
sql = "delete from %s" % obj._table
|
||||
self._cr.execute(sql)
|
||||
# 更新序号
|
||||
seqs = self.env['ir.sequence'].search([
|
||||
('code', '=', 'hr.expense.invoice')])
|
||||
for seq in seqs:
|
||||
seq.write({
|
||||
'number_next': 1,
|
||||
})
|
||||
self._cr.execute(sql)
|
||||
except Exception as e:
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
def remove_mrp(self):
|
||||
to_removes = [
|
||||
# 清除生产单据
|
||||
@@ -298,7 +325,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_mrp_bom(self):
|
||||
to_removes = [
|
||||
# 清除生产BOM
|
||||
@@ -316,7 +342,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_inventory(self):
|
||||
to_removes = [
|
||||
# 清除库存单据
|
||||
@@ -367,14 +392,12 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_account(self):
|
||||
to_removes = [
|
||||
# 清除财务会计单据
|
||||
['account.voucher.line', ],
|
||||
['account.voucher', ],
|
||||
['account.bank.statement.line', ],
|
||||
['account.bank.statement', ],
|
||||
['account.payment', ],
|
||||
['account.analytic.line', ],
|
||||
['account.analytic.account', ],
|
||||
@@ -418,17 +441,66 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_account_chart(self):
|
||||
to_removes = [
|
||||
# 清除财务科目,用于重设
|
||||
['res.partner.bank', ],
|
||||
['res.bank', ],
|
||||
['account.move.line'],
|
||||
['account.invoice'],
|
||||
['account.payment'],
|
||||
['account.bank.statement', ],
|
||||
['account.tax.account.tag', ],
|
||||
['account.tax', ],
|
||||
['account.tax', ],
|
||||
['account.account.account.tag', ],
|
||||
['wizard_multi_charts_accounts'],
|
||||
['account.account', ],
|
||||
['account.journal', ],
|
||||
]
|
||||
# todo: 要做 remove_hr,因为工资表会用到 account
|
||||
# 更新account关联,很多是多公司字段,故只存在 ir_property,故在原模型,只能用update
|
||||
try:
|
||||
# reset default tax,不管多公司
|
||||
field1 = self.env['ir.model.fields']._get('product.template', "taxes_id").id
|
||||
field2 = self.env['ir.model.fields']._get('product.template', "supplier_taxes_id").id
|
||||
|
||||
sql = ("delete from ir_default where field_id = %s or field_id = %s") % (field1, field2)
|
||||
self._cr.execute(sql)
|
||||
except Exception as e:
|
||||
pass # raise Warning(e)
|
||||
try:
|
||||
rec = self.env['res.partner'].search([])
|
||||
for r in rec:
|
||||
r.write({
|
||||
'property_account_receivable_id': None,
|
||||
'property_account_payable_id': None,
|
||||
})
|
||||
except Exception as e:
|
||||
pass # raise Warning(e)
|
||||
try:
|
||||
rec = self.env['product.category'].search([])
|
||||
for r in rec:
|
||||
r.write({
|
||||
'property_account_income_categ_id': None,
|
||||
'property_account_expense_categ_id': None,
|
||||
'property_account_creditor_price_difference_categ': None,
|
||||
'property_stock_account_input_categ_id': None,
|
||||
'property_stock_account_output_categ_id': None,
|
||||
'property_stock_valuation_account_id': None,
|
||||
})
|
||||
except Exception as e:
|
||||
pass # raise Warning(e)
|
||||
try:
|
||||
rec = self.env['stock.location'].search([])
|
||||
for r in rec:
|
||||
r.write({
|
||||
'valuation_in_account_id': None,
|
||||
'valuation_out_account_id': None,
|
||||
})
|
||||
except Exception as e:
|
||||
pass # raise Warning(e)
|
||||
|
||||
try:
|
||||
for line in to_removes:
|
||||
obj_name = line[0]
|
||||
@@ -437,21 +509,15 @@ class ResConfigSettings(models.TransientModel):
|
||||
sql = "delete from %s" % obj._table
|
||||
self._cr.execute(sql)
|
||||
|
||||
# reset default tax,不管多公司
|
||||
field1 = self.env['ir.model.fields']._get('product.template', "taxes_id").id
|
||||
field2 = self.env['ir.model.fields']._get('product.template', "supplier_taxes_id").id
|
||||
|
||||
sql = ("delete from ir_default where field_id = %s or field_id = %s") % (field1, field2)
|
||||
self._cr.execute(sql)
|
||||
|
||||
sql = "update res_company set chart_template_id=null ;"
|
||||
sql = "update res_company set chart_template_id=null;"
|
||||
self._cr.execute(sql)
|
||||
# 更新序号
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_project(self):
|
||||
to_removes = [
|
||||
# 清除项目
|
||||
@@ -472,7 +538,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_website(self):
|
||||
to_removes = [
|
||||
# 清除网站数据,w, w_blog
|
||||
@@ -500,7 +565,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_message(self):
|
||||
to_removes = [
|
||||
# 清除消息数据
|
||||
@@ -518,7 +582,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_workflow(self):
|
||||
to_removes = [
|
||||
# 清除工作流
|
||||
@@ -537,7 +600,6 @@ class ResConfigSettings(models.TransientModel):
|
||||
pass # raise Warning(e)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
def remove_all_biz(self):
|
||||
try:
|
||||
self.remove_account()
|
||||
|
||||
@@ -42,7 +42,9 @@ odoo.define('app_odoo_customize.UserMenu', function (require) {
|
||||
+ '"><img class="flag" src="app_odoo_customize/static/src/img/flags/' + lang['code'] + '.png"/>' + lang['name'] + a + '</a>';
|
||||
});
|
||||
lang_list += '<div role="separator" class="dropdown-divider"/>';
|
||||
$('switch-lang').replaceWith(lang_list);
|
||||
setTimeout( function() {
|
||||
$('switch-lang').replaceWith(lang_list);
|
||||
}, 1000);
|
||||
})
|
||||
|
||||
//取参数
|
||||
@@ -133,7 +135,7 @@ odoo.define('app_odoo_customize.UserMenu', function (require) {
|
||||
},
|
||||
//增加的方法
|
||||
_onMenuDebug: function () {
|
||||
window.location = $.param.querystring(window.location.href, 'debug');
|
||||
window.location = $.param.querystring(window.location.href, 'debug=1');
|
||||
},
|
||||
_onMenuDebugassets: function () {
|
||||
window.location = $.param.querystring(window.location.href, 'debug=assets');
|
||||
|
||||
Reference in New Issue
Block a user