odoo17 base 模块升级小bug

这两天遇到一个奇对的问题,一升级包含base模块的模块,总会发现用户界面的翻译变成了英语大写,如下

odoo17 base 模块升级小bug-LMLPHP

找到原码:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <record model="ir.module.category" id="module_category_hidden">
            <field name="name">Technical</field>
            <field name="sequence">60</field>
            <field name="visible" eval="0" />
        </record>

        <record model="ir.module.category" id="module_category_accounting">
            <field name="name">Accounting</field>
            <field name="sequence">15</field>
        </record>

        <record model="ir.module.category" id="module_category_accounting_localizations">
            <field name="name">Localization</field>
            <field name="sequence">65</field>
            <field name="visible" eval="0" />
            <field name="parent_id" ref="module_category_accounting"/>
        </record>

        <record model="ir.module.category" id="module_category_payroll_localization">
            <field name="name">Payroll Localization</field>
            <field name="visible" eval="0" />
        </record>

        <record model="ir.module.category" id="module_category_accounting_localizations_account_charts">
            <field name="parent_id" ref="module_category_accounting_localizations" />
            <field name="name">Account Charts</field>
            <field name="visible" eval="0" />
        </record>

        <record model="ir.module.category" id="module_category_user_type">
            <field name="name">User types</field>
            <field name="description">Helps you manage users.</field>
            <field name="sequence">9</field>
        </record>

        <record model="ir.module.category" id="module_category_accounting_accounting">
            <field name="name">Invoicing</field>
            <field name="sequence">4</field>
        </record>

        <record model="ir.module.category" id="module_category_sales">
            <field name="name">Sales</field>
            <field name="sequence">5</field>
        </record>

        <record model="ir.module.category" id="module_category_human_resources">
            <field name="name">Human Resources</field>
            <field name="sequence">45</field>
        </record>

        <record model="ir.module.category" id="module_category_marketing">
            <field name="name">Marketing</field>
            <field name="sequence">40</field>
        </record>

        <record model="ir.module.category" id="module_category_manufacturing">
            <field name="name">Manufacturing</field>
            <field name="sequence">30</field>
        </record>

        <record model="ir.module.category" id="module_category_website">
            <field name="name">Website</field>
            <field name="sequence">35</field>
        </record>

        <record model="ir.module.category" id="module_category_theme">
            <field name="name">Theme</field>
            <field name="exclusive" eval="0"/>
            <field name="sequence">50</field>
        </record>

        <record model="ir.module.category" id="module_category_administration">
            <field name="name">Administration</field>
            <field name="sequence">100</field>
            <field name="parent_id" eval="False"/>
        </record>

        <record model="ir.module.category" id="module_category_human_resources_appraisals">
            <field name="name">Appraisals</field>
            <field name="description">A user without any rights on Appraisals will be able to see the application, create and manage appraisals for himself and the people he's manager of.</field>
            <field name="sequence">15</field>
        </record>

        <record model="ir.module.category" id="module_category_sales_sign">
            <field name="name">Sign</field>
            <field name="description">Helps you sign and complete your documents easily.</field>
            <field name="sequence">25</field>
        </record>

        <record model="ir.module.category" id="module_category_services">
            <field name="name">Services</field>
            <field name="sequence">10</field>
        </record>

        <record model="ir.module.category" id="module_category_services_helpdesk">
            <field name="name">Helpdesk</field>
            <field name="description">After-sales services</field>
            <field name="sequence">14</field>
        </record>

        <record model="ir.module.category" id="module_category_services_appointment">
            <field name="name">Appointment</field>
            <field name="parent_id" ref="module_category_services"/>
        </record>

        <record model="ir.module.category" id="module_category_services_field_service">
            <field name="name">Field Service</field>
            <field name="parent_id" ref="module_category_services"/>
        </record>

        <record model="ir.module.category" id="module_category_inventory">
            <field name="name">Inventory</field>
            <field name="sequence">25</field>
        </record>

        <record model="ir.module.category" id="module_category_productivity">
            <field name="name">Productivity</field>
            <field name="sequence">50</field>
        </record>

        <record model="ir.module.category" id="module_category_customizations">
            <field name="name">Customizations</field>
            <field name="sequence">55</field>
        </record>

        <record model="ir.module.category" id="module_category_administration_administration">
            <field name="name">Administration</field>
            <field name="parent_id" ref="module_category_administration"/>
        </record>

        <record model="ir.module.category" id="module_category_usability">
            <field name="name">其它权限</field>
            <field name="sequence">101</field>
        </record>

        <record model="ir.module.category" id="module_category_extra">
            <field name="name">Other Extra Rights</field>
            <field name="sequence">102</field>
        </record>

        <!-- add applications to base groups -->
        <record model="res.groups" id="group_erp_manager">
            <field name="category_id" ref="module_category_administration_administration"/>
        </record>
        <record model="res.groups" id="group_system">
            <field name="category_id" ref="module_category_administration_administration"/>
        </record>

        <record model="res.groups" id="group_user">
            <field name="category_id" ref="module_category_user_type"/>
        </record>

        <record model="res.groups" id="group_multi_company">
            <field name="category_id" ref="module_category_usability"/>
        </record>

        <record model="res.groups" id="group_multi_currency">
            <field name="category_id" ref="module_category_usability"/>
        </record>

        <record model="res.groups" id="group_no_one">
            <field name="category_id" ref="module_category_usability"/>
        </record>

        <record id="group_portal" model="res.groups">
            <field name="category_id" ref="module_category_user_type"/>
        </record>

        <record id="group_public" model="res.groups">
            <field name="category_id" ref="module_category_user_type"/>
        </record>

        <record id="group_partner_manager" model="res.groups">
            <field name="category_id" ref="module_category_usability"/>
        </record>

    </data>
</odoo>

翻译文件:

odoo17 base 模块升级小bug-LMLPHP

试着把代码改下:

<record model="ir.module.category" id="module_category_usability">
    <field name="name">其它权限</field>
    <field name="sequence">101</field>
</record>

其它都还是那样,本想着是因为自己写的代码哪些没规范,就一点一点排除,最后想个方法,是不是base模块自身的升级功能引起的,就重新建新数据库,其它程序一点不安装,又重 新对base模块进行升级,问题依旧,噢,原来是这个原因,再看看base模块有什么不一样的,发现:、

odoo17 base 模块升级小bug-LMLPHP

这是个干什么的

看看odoo16中的是

# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import controllers
from . import models
from . import populate
from . import report
from . import wizard


def post_init(cr, registry):
    """Rewrite ICP's to force groups"""
    from odoo import api, SUPERUSER_ID

    env = api.Environment(cr, SUPERUSER_ID, {})
    env['ir.config_parameter'].init(force=True)

都有这句:

env['ir.config_parameter'].init(force=True)

这应该不是原因,还应回到翻译上来,升级没经翻译??

2024-08-10 09:09:44,242 14256 INFO s002 odoo.modules.loading: loading 1 modules... 
2024-08-10 09:09:44,242 14256 INFO s002 odoo.modules.loading: Loading module base (1/1) 
2024-08-10 09:09:44,262 14256 INFO s002 odoo.modules.registry: module base: creating or updating database tables 
2024-08-10 09:09:44,890 14256 INFO s002 odoo.modules.loading: loading base/data/res_bank.xml 
2024-08-10 09:09:44,890 14256 INFO s002 odoo.modules.loading: loading base/data/res.lang.csv 
2024-08-10 09:09:45,031 14256 INFO s002 odoo.modules.loading: loading base/data/res_lang_data.xml 
2024-08-10 09:09:45,047 14256 INFO s002 odoo.modules.loading: loading base/data/res_partner_data.xml 
2024-08-10 09:09:45,062 14256 INFO s002 odoo.modules.loading: loading base/data/res_currency_data.xml 
2024-08-10 09:09:45,172 14256 INFO s002 odoo.modules.loading: loading base/data/res_company_data.xml 
2024-08-10 09:09:45,172 14256 INFO s002 odoo.modules.loading: loading base/data/res_users_data.xml 
2024-08-10 09:09:45,172 14256 INFO s002 odoo.modules.loading: loading base/data/report_paperformat_data.xml 
2024-08-10 09:09:45,187 14256 INFO s002 odoo.modules.loading: loading base/data/res_country_data.xml 
2024-08-10 09:09:45,342 14256 INFO s002 odoo.modules.loading: loading base/data/ir_demo_data.xml 
2024-08-10 09:09:45,361 14256 INFO s002 odoo.modules.loading: loading base/security/base_groups.xml 
2024-08-10 09:09:45,451 14256 INFO s002 odoo.modules.loading: loading base/security/base_security.xml 
2024-08-10 09:09:45,466 14256 INFO s002 odoo.modules.loading: loading base/views/base_menus.xml 
2024-08-10 09:09:45,544 14256 INFO s002 odoo.modules.loading: loading base/views/decimal_precision_views.xml 
2024-08-10 09:09:45,560 14256 INFO s002 odoo.modules.loading: loading base/views/res_config_views.xml 
2024-08-10 09:09:45,576 14256 INFO s002 odoo.modules.loading: loading base/data/res.country.state.csv 
2024-08-10 09:09:46,707 14256 INFO s002 odoo.modules.loading: loading base/views/ir_actions_views.xml 
2024-08-10 09:09:46,864 14256 INFO s002 odoo.modules.loading: loading base/views/ir_asset_views.xml 
2024-08-10 09:09:46,895 14256 INFO s002 odoo.modules.loading: loading base/views/ir_config_parameter_views.xml 
2024-08-10 09:09:46,910 14256 INFO s002 odoo.modules.loading: loading base/views/ir_cron_views.xml 
2024-08-10 09:09:46,957 14256 INFO s002 odoo.modules.loading: loading base/views/ir_cron_trigger_views.xml 
2024-08-10 09:09:46,973 14256 INFO s002 odoo.modules.loading: loading base/views/ir_filters_views.xml 
2024-08-10 09:09:47,004 14256 INFO s002 odoo.modules.loading: loading base/views/ir_mail_server_views.xml 
2024-08-10 09:09:47,035 14256 INFO s002 odoo.modules.loading: loading base/views/ir_model_views.xml 
2024-08-10 09:09:47,223 14256 INFO s002 odoo.modules.loading: loading base/views/ir_attachment_views.xml 
2024-08-10 09:09:47,254 14256 INFO s002 odoo.modules.loading: loading base/views/ir_rule_views.xml 
2024-08-10 09:09:47,301 14256 INFO s002 odoo.modules.loading: loading base/views/ir_sequence_views.xml 
2024-08-10 09:09:47,332 14256 INFO s002 odoo.modules.loading: loading base/views/ir_ui_menu_views.xml 
2024-08-10 09:09:47,363 14256 INFO s002 odoo.modules.loading: loading base/views/ir_ui_view_views.xml 
2024-08-10 09:09:47,426 14256 INFO s002 odoo.modules.loading: loading base/views/ir_default_views.xml 
2024-08-10 09:09:47,457 14256 INFO s002 odoo.modules.loading: loading base/data/ir_cron_data.xml 
2024-08-10 09:09:47,473 14256 INFO s002 odoo.modules.loading: loading base/report/ir_model_report.xml 
2024-08-10 09:09:47,473 14256 INFO s002 odoo.modules.loading: loading base/report/ir_model_templates.xml 
2024-08-10 09:09:47,488 14256 INFO s002 odoo.modules.loading: loading base/views/ir_logging_views.xml 
2024-08-10 09:09:47,520 14256 INFO s002 odoo.modules.loading: loading base/views/ir_qweb_widget_templates.xml 
2024-08-10 09:09:47,535 14256 INFO s002 odoo.modules.loading: loading base/views/ir_module_views.xml 
2024-08-10 09:09:47,598 14256 INFO s002 odoo.modules.loading: loading base/data/ir_module_category_data.xml 
2024-08-10 09:09:47,723 14256 INFO s002 odoo.modules.loading: loading base/data/ir_module_module.xml 
2024-08-10 09:09:47,754 14256 INFO s002 odoo.modules.loading: loading base/report/ir_module_reports.xml 
2024-08-10 09:09:47,754 14256 INFO s002 odoo.modules.loading: loading base/report/ir_module_report_templates.xml 
2024-08-10 09:09:47,754 14256 INFO s002 odoo.modules.loading: loading base/wizard/base_module_update_views.xml 
2024-08-10 09:09:47,770 14256 INFO s002 odoo.modules.loading: loading base/wizard/base_language_install_views.xml 
2024-08-10 09:09:47,785 14256 INFO s002 odoo.modules.loading: loading base/wizard/base_import_language_views.xml 
2024-08-10 09:09:47,801 14256 INFO s002 odoo.modules.loading: loading base/wizard/base_module_upgrade_views.xml 
2024-08-10 09:09:47,832 14256 INFO s002 odoo.modules.loading: loading base/wizard/base_module_uninstall_views.xml 
2024-08-10 09:09:47,832 14256 INFO s002 odoo.modules.loading: loading base/wizard/base_export_language_views.xml 
2024-08-10 09:09:47,848 14256 INFO s002 odoo.modules.loading: loading base/wizard/base_partner_merge_views.xml 
2024-08-10 09:09:47,863 14256 INFO s002 odoo.modules.loading: loading base/data/ir_demo_failure_data.xml 
2024-08-10 09:09:47,879 14256 INFO s002 odoo.modules.loading: loading base/views/ir_profile_views.xml 
2024-08-10 09:09:47,910 14256 INFO s002 odoo.modules.loading: loading base/views/res_company_views.xml 
2024-08-10 09:09:47,941 14256 INFO s002 odoo.modules.loading: loading base/views/res_lang_views.xml 
2024-08-10 09:09:47,973 14256 INFO s002 odoo.modules.loading: loading base/views/res_partner_views.xml 
2024-08-10 09:09:48,113 14256 INFO s002 odoo.modules.loading: loading base/views/res_bank_views.xml 
2024-08-10 09:09:48,160 14256 INFO s002 odoo.modules.loading: loading base/views/res_country_views.xml 
2024-08-10 09:09:48,207 14256 INFO s002 odoo.modules.loading: loading base/views/res_currency_views.xml 
2024-08-10 09:09:48,254 14256 INFO s002 odoo.modules.loading: loading base/views/res_users_views.xml 
2024-08-10 09:09:48,394 14256 INFO s002 odoo.modules.loading: loading base/views/res_users_identitycheck_views.xml 
2024-08-10 09:09:48,410 14256 INFO s002 odoo.modules.loading: loading base/views/ir_property_views.xml 
2024-08-10 09:09:48,426 14256 INFO s002 odoo.modules.loading: loading base/views/res_config_settings_views.xml 
2024-08-10 09:09:48,441 14256 INFO s002 odoo.modules.loading: loading base/views/report_paperformat_views.xml 
2024-08-10 09:09:48,457 14256 INFO s002 odoo.modules.loading: loading base/security/ir.model.access.csv 
2024-08-10 09:09:48,644 14256 INFO s002 odoo.addons.base.models.ir_module: module base: loading translation file d:\od172406\odoo\addons\base\i18n\zh_cn.po for language zh_CN 
2024-08-10 09:09:48,644 14256 INFO s002 odoo.tools.translate: loading base translation file d:\od172406\odoo\addons\base\i18n\zh_cn.po for language zh_CN 
2024-08-10 09:09:49,150 14256 INFO s002 odoo.modules.loading: Module base loaded in 4.91s, 7100 queries (+7100 other) 
2024-08-10 09:09:49,150 14256 INFO s002 odoo.modules.loading: 1 modules loaded in 4.91s, 7100 queries (+7100 extra) 
2024-08-10 09:09:49,161 14256 INFO s002 odoo.modules.loading: updating modules list 
2024-08-10 09:09:49,161 14256 INFO s002 odoo.addons.base.models.ir_module: ALLOW access to module.update_list on [] to user __system__ #1 via 127.0.0.1 
2024-08-10 09:09:49,630 14256 INFO s002 odoo.modules.loading: loading 11 modules... 

明明是先加载了data中的文件件,最后进行翻译的呀

新建库,重新标记

odoo17 base 模块升级小bug-LMLPHP

升级base:

odoo17 base 模块升级小bug-LMLPHP

#. module: base
#: model:ir.module.category,name:base.module_category_administration_administration
msgid "Administration"
msgstr "管理++"

#. module: base
#: model:ir.module.category,name:base.module_category_administration
#: model_terms:ir.ui.view,arch_db:base.user_groups_view
msgid "Administration"
msgstr "管理+员"
#. module: base
#: model:ir.module.category,name:base.module_category_administration_administration
#: model_terms:ir.ui.view,arch_db:base.user_groups_view
msgid "Administration"
msgstr "管理++员"

#. module: base
#: model:ir.module.category,name:base.module_category_administration
msgid "Administration"
msgstr "管理+员"

odoo17 base 模块升级小bug-LMLPHP

内容动了,页面的却没动

浏览器清空,重新打开

odoo17 base 模块升级小bug-LMLPHP

真怪了,只是在首次安装时进行了翻译,后面的多次升级没有,上面的一直是大写的administation,不知从哪里来的

08-13 23:05