fix #IB181K app_odoo_customize对18版本增加模块类型,Odoo中文应用。了解下我们需要优先升级的模块18

This commit is contained in:
Chill
2024-11-06 14:07:23 +08:00
parent bd2e90e6d9
commit c067c819fa
4 changed files with 55 additions and 0 deletions

View File

@@ -73,6 +73,7 @@
'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',
'app_odoo_customize/static/src/js/base_import_list_renderer.js',
'app_odoo_customize/static/src/webclient/*.js',
'app_odoo_customize/static/src/webclient/user_menu.xml',
'app_odoo_customize/static/src/xml/res_config_edition.xml',

View File

@@ -96,3 +96,10 @@ class IrModuleModule(models.Model):
if author in ['odooai.cn', 'sunpop.cn', 'odooapp.cn']:
self.module_type = 'odooapp.cn'
return res
def web_read(self, specification):
fields = list(specification.keys())
module_type = self.env.context.get('module_type', 'official')
if module_type == 'odooapp.cn':
self.env.context = {**self.env.context, "module_type": 'official'}
return super().web_read(specification)

View File

@@ -0,0 +1,26 @@
/** @odoo-module */
import { patch } from "@web/core/utils/patch";
import { ImportModuleListRenderer } from "@base_import_module/base_import_list_renderer";
patch(ImportModuleListRenderer.prototype, {
async onCellClicked(record, column, ev) {
if (record._values.module_type && record._values.module_type === 'odooapp.cn') {
const re_action = {
name: "more_info",
res_model: "ir.module.module",
res_id: record.resId,
type: "ir.actions.act_window",
views: [[false, "form"]],
context: {
'module_name': record._values.name,
'module_type': record._values.module_type,
}
}
this.env.services.action.doAction(re_action);
}
else{
super.onCellClicked(record, column, ev);
}
}
})

View File

@@ -54,6 +54,18 @@
<field name="addons_path_id" invisible="1"/>
<field name="addons_path" groups="base.group_no_one"/>
</field>
<xpath expr="//button[@name='button_immediate_install']" position="attributes">
<attribute name="invisible">to_buy or state != 'uninstalled' or (module_type and module_type not in ('official', 'odooapp.cn'))</attribute>
</xpath>
<xpath expr="//button[@name='button_immediate_upgrade']" position="attributes">
<attribute name="invisible">state == 'uninstalled' or (module_type and module_type not in ('official', 'odooapp.cn'))</attribute>
</xpath>
<xpath expr="//button[@name='button_immediate_install_app']" position="attributes">
<attribute name="invisible">state != 'uninstalled' or module_type in ('official', 'odooapp.cn')</attribute>
</xpath>
<xpath expr="//button[@name='button_immediate_install_app'][2]" position="attributes">
<attribute name="invisible">state == 'uninstalled' or module_type in ('official', 'odooapp.cn')</attribute>
</xpath>
</field>
</record>
@@ -70,6 +82,15 @@
<xpath expr="//main//code" position="attributes">
<attribute name="groups"></attribute>
</xpath>
<xpath expr="//button[@name='button_immediate_install']" position="attributes">
<attribute name="invisible">state != 'uninstalled' or (module_type and module_type not in ('official', 'odooapp.cn'))</attribute>
</xpath>
<xpath expr="//button[@name='button_immediate_install_app']" position="attributes">
<attribute name="invisible">state != 'uninstalled' or module_type in ('official', 'odooapp.cn')</attribute>
</xpath>
<xpath expr="//button[@name='button_immediate_install_app'][2]" position="attributes">
<attribute name="invisible">state == 'uninstalled' or module_type in ('official', 'odooapp.cn')</attribute>
</xpath>
<!--显示快速升级-->
<xpath expr="//button[@name='button_immediate_install']" position="after">
<button type="object" class="btn btn-default btn-sm float-right" name="button_uninstall_wizard"