mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
[FIX] app_odoo_customize: security
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'odoo17 Tweak,Ai Employee,Boost,Customize All in One. Customize,UI,Boost,Security,Data,Development Enhance',
|
'name': 'odoo17 Tweak,Ai Employee,Boost,Customize All in One. Customize,UI,Boost,Security,Data,Development Enhance',
|
||||||
'version': '24.02.29',
|
'version': '24.03.11',
|
||||||
'author': 'odooai.cn',
|
'author': 'odooai.cn',
|
||||||
'category': 'Extra Tools',
|
'category': 'Extra Tools',
|
||||||
'website': 'https://www.odooai.cn',
|
'website': 'https://www.odooai.cn',
|
||||||
|
|||||||
@@ -69,17 +69,22 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def set_module_url(self, rec=None):
|
def set_module_url(self, rec=None):
|
||||||
|
if not self._app_check_sys_op():
|
||||||
|
raise UserError(_('Not allow.'))
|
||||||
config_parameter = self.env['ir.config_parameter'].sudo()
|
config_parameter = self.env['ir.config_parameter'].sudo()
|
||||||
app_enterprise_url = config_parameter.get_param('app_enterprise_url', 'https://www.odooai.cn')
|
app_enterprise_url = config_parameter.get_param('app_enterprise_url', 'https://www.odooai.cn')
|
||||||
sql = "UPDATE ir_module_module SET website = '%s' WHERE license like '%s' and website <> ''" % (app_enterprise_url, 'OEEL%')
|
modules = self.env['ir.module.module'].search([('license', 'like', 'OEEL%'), ('website', '!=', False)])
|
||||||
|
if modules:
|
||||||
|
sql = "UPDATE ir_module_module SET website = '%s' WHERE id IN %s" % (app_enterprise_url, tuple(modules.ids))
|
||||||
try:
|
try:
|
||||||
self._cr.execute(sql)
|
self._cr.execute(sql)
|
||||||
self._cr.commit()
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# 清数据,o=对象, s=序列
|
# 清数据,o=对象, s=序列
|
||||||
def remove_app_data(self, o, s=[]):
|
def _remove_app_data(self, o, s=[]):
|
||||||
|
if not self._app_check_sys_op():
|
||||||
|
raise UserError(_('Not allow.'))
|
||||||
for line in o:
|
for line in o:
|
||||||
# 检查是否存在
|
# 检查是否存在
|
||||||
try:
|
try:
|
||||||
@@ -131,7 +136,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
seqs = [
|
seqs = [
|
||||||
'sale',
|
'sale',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_product(self):
|
def remove_product(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -142,7 +147,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
seqs = [
|
seqs = [
|
||||||
'product.product',
|
'product.product',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_product_attribute(self):
|
def remove_product_attribute(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -151,7 +156,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'product.attribute',
|
'product.attribute',
|
||||||
]
|
]
|
||||||
seqs = []
|
seqs = []
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_pos(self):
|
def remove_pos(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -164,12 +169,12 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
seqs = [
|
seqs = [
|
||||||
'pos.',
|
'pos.',
|
||||||
]
|
]
|
||||||
res = self.remove_app_data(to_removes, seqs)
|
res = self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
# 更新要关帐的值,因为 store=true 的计算字段要重置
|
# 更新要关帐的值,因为 store=true 的计算字段要重置
|
||||||
|
|
||||||
try:
|
try:
|
||||||
statement = self.env['account.bank.statement'].sudo().search([])
|
statement = self.env['account.bank.statement'].search([])
|
||||||
for s in statement:
|
for s in statement:
|
||||||
s._end_balance()
|
s._end_balance()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -187,7 +192,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
seqs = [
|
seqs = [
|
||||||
'purchase.',
|
'purchase.',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_expense(self):
|
def remove_expense(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -200,7 +205,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
seqs = [
|
seqs = [
|
||||||
'hr.expense.',
|
'hr.expense.',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_mrp(self):
|
def remove_mrp(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -219,7 +224,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
seqs = [
|
seqs = [
|
||||||
'mrp.',
|
'mrp.',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_mrp_bom(self):
|
def remove_mrp_bom(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -228,7 +233,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'mrp.bom',
|
'mrp.bom',
|
||||||
]
|
]
|
||||||
seqs = []
|
seqs = []
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_inventory(self):
|
def remove_inventory(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -256,7 +261,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'product.tracking.default',
|
'product.tracking.default',
|
||||||
'WH/',
|
'WH/',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_account(self):
|
def remove_account(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -277,7 +282,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'hr.expense.sheet',
|
'hr.expense.sheet',
|
||||||
'account.move',
|
'account.move',
|
||||||
]
|
]
|
||||||
res = self.remove_app_data(to_removes, [])
|
res = self._remove_app_data(to_removes, [])
|
||||||
|
|
||||||
# extra 更新序号
|
# extra 更新序号
|
||||||
domain = [
|
domain = [
|
||||||
@@ -393,7 +398,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
|
|
||||||
seqs = []
|
seqs = []
|
||||||
|
|
||||||
res = self.remove_app_data(to_removes, seqs)
|
res = self._remove_app_data(to_removes, seqs)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def remove_project(self):
|
def remove_project(self):
|
||||||
@@ -412,7 +417,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'project.task.stage.personal',
|
'project.task.stage.personal',
|
||||||
]
|
]
|
||||||
seqs = []
|
seqs = []
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_quality(self):
|
def remove_quality(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -431,7 +436,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'quality.alert',
|
'quality.alert',
|
||||||
# 'quality.point',
|
# 'quality.point',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_quality_setting(self):
|
def remove_quality_setting(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -443,7 +448,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'quality.reason',
|
'quality.reason',
|
||||||
'quality.tag',
|
'quality.tag',
|
||||||
]
|
]
|
||||||
return self.remove_app_data(to_removes)
|
return self._remove_app_data(to_removes)
|
||||||
|
|
||||||
def remove_website(self):
|
def remove_website(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -464,7 +469,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
# 'website',
|
# 'website',
|
||||||
]
|
]
|
||||||
seqs = []
|
seqs = []
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_message(self):
|
def remove_message(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -474,7 +479,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
'mail.activity',
|
'mail.activity',
|
||||||
]
|
]
|
||||||
seqs = []
|
seqs = []
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_workflow(self):
|
def remove_workflow(self):
|
||||||
to_removes = [
|
to_removes = [
|
||||||
@@ -483,7 +488,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
# 'wkf.instance',
|
# 'wkf.instance',
|
||||||
]
|
]
|
||||||
seqs = []
|
seqs = []
|
||||||
return self.remove_app_data(to_removes, seqs)
|
return self._remove_app_data(to_removes, seqs)
|
||||||
|
|
||||||
def remove_all_biz(self):
|
def remove_all_biz(self):
|
||||||
self.remove_account()
|
self.remove_account()
|
||||||
@@ -519,7 +524,7 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def action_set_app_doc_root_to_my(self):
|
def action_set_app_doc_root_to_my(self):
|
||||||
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
base_url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||||
self.app_doc_root_url = base_url
|
self.app_doc_root_url = base_url
|
||||||
|
|
||||||
# def action_set_all_to_app_doc_root_url(self):
|
# def action_set_all_to_app_doc_root_url(self):
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
<section class="container app">
|
<section class="container app">
|
||||||
<div class="oe_row oe_spaced" style="max-width: 95%;">
|
<div class="oe_row oe_spaced" style="max-width: 95%;">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<h2 class="oe_slogan">This is a Long Term Support Apps.Update: v17.24.03.01</h2>
|
<h2 class="oe_slogan">This is a Long Term Support Apps.Update: v17.24.03.11</h2>
|
||||||
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
<div class="oe_demo" style=" margin: 30px auto 0; padding: 0 15px 0 0; border:none; width: 96%;">
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
<li class="list-group-item">1. Deletes Odoo label in footer</li>
|
<li class="list-group-item">1. Deletes Odoo label in footer</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user