合并企业版代码(未测试,先提交到测试分支)

This commit is contained in:
qihao.gong@jikimo.com
2023-04-14 17:42:23 +08:00
parent 7a7b3d7126
commit d28525526a
1300 changed files with 513579 additions and 5426 deletions

View File

@@ -0,0 +1 @@
from . import base_module_uninstall

View File

@@ -0,0 +1,61 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api
class BaseModuleUninstall(models.TransientModel):
_inherit = "base.module.uninstall"
is_studio = fields.Boolean(compute='_compute_is_studio')
custom_views = fields.Integer(compute='_compute_custom_views')
custom_reports = fields.Integer(compute='_compute_custom_reports')
custom_models = fields.Integer(compute='_compute_custom_models')
custom_fields = fields.Integer(compute='_compute_custom_fields')
@api.depends('module_ids')
def _compute_is_studio(self):
for wizard in self:
wizard.is_studio = 'web_studio' in wizard.module_ids.mapped('name')
@api.depends('module_ids')
def _compute_custom_views(self):
for wizard in self:
view_ids = self.env['ir.model.data'].search([
('module', '=', 'studio_customization'),
('model', '=', 'ir.ui.view'),
]).mapped('res_id')
wizard.custom_views = self.env['ir.ui.view'].search_count([
('id', 'in', view_ids),
('type', '!=', 'qweb'),
])
@api.depends('module_ids')
def _compute_custom_reports(self):
for wizard in self:
wizard.custom_reports = self.env['ir.model.data'].search_count([
('module', '=', 'studio_customization'),
('model', '=', 'ir.actions.report'),
])
def _get_models(self):
# Overridden to include customizations made with studio
res = super()._get_models()
if self.is_studio:
res |= self.env['ir.model'].search([
('transient', '=', False),
('state', '=', 'manual')
])
return res
@api.depends('model_ids')
def _compute_custom_models(self):
for wizard in self:
wizard.custom_models = len(wizard.model_ids.filtered(lambda x: x.state == 'manual'))
@api.depends('module_ids')
def _compute_custom_fields(self):
for wizard in self:
wizard.custom_fields = self.env['ir.model.fields'].search_count([
('state', '=', 'manual'),
])

View File

@@ -0,0 +1,23 @@
<odoo>
<data>
<record id="view_base_module_uninstall_studio" model="ir.ui.view">
<field name="name">base.module.uninstall.view.form.studio</field>
<field name="model">base.module.uninstall</field>
<field name="inherit_id" ref="base.view_base_module_uninstall"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='model_ids']" position="after">
<field name="is_studio" invisible="1"/>
<div class="alert alert-danger" role="alert" attrs="{'invisible': ['|',('is_studio', '!=', True),'&amp;','&amp;','&amp;',('custom_models', '=', 0),('custom_fields', '=', 0),('custom_views', '=', 0),('custom_reports', '=', 0)]}">
<h3 class="text-danger">Customization made with Studio will be permanently lost</h3>
<group>
<field string="Custom models:" name="custom_models"/>
<field string="Custom fields:" name="custom_fields"/>
<field string="Custom views:" name="custom_views"/>
<field string="Custom reports:" name="custom_reports"/>
</group>
</div>
</xpath>
</field>
</record>
</data>
</odoo>