mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
opt event
This commit is contained in:
@@ -31,7 +31,7 @@ def post_init_hook(cr, registry):
|
||||
数据初始化,只在安装后执行,更新时不执行
|
||||
"""
|
||||
try:
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
env = api.Environment(cr, SUPERUSER_ID, {'active_test': False})
|
||||
ids = env['product.category'].sudo().with_context(lang='zh_CN').search([
|
||||
('parent_id', '!=', False)
|
||||
], order='parent_path')
|
||||
@@ -43,9 +43,24 @@ def post_init_hook(cr, registry):
|
||||
], order='parent_path')
|
||||
for rec in ids:
|
||||
rec._compute_complete_name()
|
||||
# 超级用户改时区为中国
|
||||
ids = env['res.users'].sudo().with_context(lang='zh_CN').browse([1, 2])
|
||||
ids.write({'tz': "Etc/GMT-8"})
|
||||
# 超级用户及模板用户改时区为中国
|
||||
ids = env['res.users'].sudo().with_context(lang='zh_CN').browse([1,2,3,4,5])
|
||||
# rec_extra = env.ref('base.template_portal_user_id')
|
||||
# if rec_extra:
|
||||
# ids += rec_extra
|
||||
ids.write({
|
||||
'tz': "Etc/GMT-8",
|
||||
'lang': "zh_CN",
|
||||
})
|
||||
# 公司价格改人民币
|
||||
env = api.Environment(cr, SUPERUSER_ID, {'active_test': True})
|
||||
ids = env['res.company'].sudo().search([], limit=1)
|
||||
if ids:
|
||||
ids.write({'currency_id': env.ref('base.CNY').id})
|
||||
# 价格表改人民币
|
||||
ids = env['product.pricelist'].sudo().search([], limit=1)
|
||||
if ids:
|
||||
ids.write({'currency_id': env.ref('base.CNY').id})
|
||||
except Exception as e:
|
||||
raise Warning(e)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user