prepare #IAXMX0 app_base_chinese,app_base_chinese_website和l10n_cn_standard_latest升级至18 置顶

This commit is contained in:
Ivan Office
2024-11-04 17:36:33 +08:00
parent 6233a29e32
commit d702022230
5 changed files with 39 additions and 32 deletions

View File

@@ -14,7 +14,7 @@
<!-- eval="('res.users', 'notification_type', 'inbox')"/>--> <!-- eval="('res.users', 'notification_type', 'inbox')"/>-->
<!--设置产品默认是可库存产品--> <!--设置产品默认是可库存产品-->
<function model="ir.default" name="set" <function model="ir.default" name="set"
eval="('product.template', 'detailed_type', 'product')"/> eval="('product.template', 'type', 'consu')"/>
<!--设置翻译导出默认中文--> <!--设置翻译导出默认中文-->
<function model="ir.default" name="set" <function model="ir.default" name="set"
eval="('base.language.export', 'lang', 'zh_CN')"/> eval="('base.language.export', 'lang', 'zh_CN')"/>

View File

@@ -4,8 +4,8 @@
<record id="sales_team.team_sales_department" model="crm.team" context="{'lang': 'zh_CN'}"> <record id="sales_team.team_sales_department" model="crm.team" context="{'lang': 'zh_CN'}">
<field name="name">中国</field> <field name="name">中国</field>
</record> </record>
<record id="sales_team.team_sales_department" model="crm.team" context="{'lang': 'en'}"> <!-- <record id="sales_team.team_sales_department" model="crm.team" context="{'lang': 'en'}">-->
<field name="name">China</field> <!-- <field name="name">China</field>-->
</record> <!-- </record>-->
</data> </data>
</odoo> </odoo>

View File

@@ -17,6 +17,8 @@
from odoo import api, SUPERUSER_ID, _ from odoo import api, SUPERUSER_ID, _
import logging
_logger = logging.getLogger(__name__)
def pre_init_hook(cr): def pre_init_hook(cr):
""" """
@@ -26,25 +28,24 @@ def pre_init_hook(cr):
pass pass
def post_init_hook(cr, registry): def post_init_hook(env):
""" """
数据初始化,只在安装后执行,更新时不执行 数据初始化,只在安装后执行,更新时不执行
""" """
try: try:
env = api.Environment(cr, SUPERUSER_ID, {'active_test': False}) ids = env['product.category'].sudo().with_context(lang='zh_CN', active_test=False).search([
ids = env['product.category'].sudo().with_context(lang='zh_CN').search([
('parent_id', '!=', False) ('parent_id', '!=', False)
], order='parent_path') ], order='parent_path')
for rec in ids: for rec in ids:
rec._compute_complete_name() rec._compute_complete_name()
ids = env['stock.location'].sudo().with_context(lang='zh_CN').search([ ids = env['stock.location'].sudo().with_context(lang='zh_CN', active_test=False).search([
('location_id', '!=', False), ('location_id', '!=', False),
('usage', '!=', 'views'), ('usage', '!=', 'views'),
], order='parent_path') ], order='parent_path')
for rec in ids: for rec in ids:
rec._compute_complete_name() rec._compute_complete_name()
# 超级用户及模板用户改时区为中国 # 超级用户及模板用户改时区为中国
ids = env['res.users'].sudo().with_context(lang='zh_CN').browse([1,2,3,4,5]) ids = env['res.users'].sudo().with_context(lang='zh_CN', active_test=False).browse([1, 2, 3, 4, 5])
# rec_extra = env.ref('base.template_portal_user_id') # rec_extra = env.ref('base.template_portal_user_id')
# if rec_extra: # if rec_extra:
# ids += rec_extra # ids += rec_extra
@@ -53,18 +54,23 @@ def post_init_hook(cr, registry):
'lang': "zh_CN", 'lang': "zh_CN",
}) })
# 公司价格改人民币 # 公司价格改人民币
env = api.Environment(cr, SUPERUSER_ID, {'active_test': True}) ids = env['res.company'].sudo().with_context(active_test=False).search([], limit=1)
ids = env['res.company'].sudo().search([], limit=1)
if ids: if ids:
ids.write({'currency_id': env.ref('base.CNY').id}) try:
ids.write({'currency_id': env.ref('base.CNY').id})
except Exception as e:
_logger.error('cn: company write currency_id error.')
# 价格表改人民币 # 价格表改人民币
ids = env['product.pricelist'].sudo().search([], limit=1) ids = env['product.pricelist'].sudo().with_context(active_test=False).search([], limit=1)
if ids: if ids:
ids.write({'currency_id': env.ref('base.CNY').id}) try:
ids.write({'currency_id': env.ref('base.CNY').id})
except Exception as e:
_logger.error('cn: pricelist write currency_id error.')
except Exception as e: except Exception as e:
raise Warning(e) raise Warning(e)
def uninstall_hook(cr, registry): def uninstall_hook(env):
""" """
数据初始化,卸载时执行 数据初始化,卸载时执行
""" """

View File

@@ -6,7 +6,7 @@
<field name="inherit_id" ref="base.module_form"/> <field name="inherit_id" ref="base.module_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//field[@name='description_html']" position="before"> <xpath expr="//field[@name='description_html']" position="before">
<field name="description_html_cn" class="oe_styling_v8" attrs="{'invisible': [('description_html_cn', '=', False)]}"/> <field name="description_html_cn" class="oe_styling_v8" invisible="not description_html_cn"/>
</xpath> </xpath>
</field> </field>
</record> </record>

View File

@@ -79,22 +79,23 @@
</record> </record>
<!--Partner kanban 视图用继承方式改写2017-11-23,ivan--> <!--Partner kanban 视图用继承方式改写2017-11-23,ivan-->
<record id="app_res_partner_kanban_view" model="ir.ui.view"> <!-- todo: 迁移到 app_base 等-->
<field name="name">app.res.partner.kanban</field> <!-- <record id="app_res_partner_kanban_view" model="ir.ui.view">-->
<field name="model">res.partner</field> <!-- <field name="name">app.res.partner.kanban</field>-->
<field name="inherit_id" ref="base.res_partner_kanban_view"/> <!-- <field name="model">res.partner</field>-->
<field name="arch" type="xml"> <!-- <field name="inherit_id" ref="base.res_partner_kanban_view"/>-->
<xpath expr="//templates" position="before"> <!-- <field name="arch" type="xml">-->
<field name="credit_limit"/> <!-- <xpath expr="//templates" position="before">-->
</xpath> <!-- <field name="credit_limit"/>-->
<xpath expr="//div[hasclass('oe_kanban_details')]/div/ul" position="inside"> <!-- </xpath>-->
<li t-if="record.credit_limit and record.credit_limit.raw_value"> <!-- <xpath expr="//div[hasclass('oe_kanban_details')]/div/ul" position="inside">-->
Credit <!-- <li t-if="record.credit_limit and record.credit_limit.raw_value">-->
<field name="credit_limit"/> <!-- Credit-->
</li> <!-- <field name="credit_limit"/>-->
</xpath> <!-- </li>-->
</field> <!-- </xpath>-->
</record> <!-- </field>-->
<!-- </record>-->
<!--end客户--> <!--end客户-->
<!-- 为供应商菜单单独增加筛选器 2017-11-13 --> <!-- 为供应商菜单单独增加筛选器 2017-11-13 -->