opt event

This commit is contained in:
Ivan Office
2023-11-17 23:17:22 +08:00
parent b436bf91ce
commit 0fe52a3e76
4 changed files with 29 additions and 14 deletions

View File

@@ -18,7 +18,7 @@
{ {
'name': 'odoo中文版套件之基础,中国会计基础,Chinese Enhance All in One', 'name': 'odoo中文版套件之基础,中国会计基础,Chinese Enhance All in One',
'version': '16.23.11.10', 'version': '16.23.11.17',
'author': 'odooai.cn', 'author': 'odooai.cn',
'category': 'Base', 'category': 'Base',
'website': 'https://www.odooai.cn', 'website': 'https://www.odooai.cn',

View File

@@ -2,8 +2,8 @@
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<!-- Price list --> <!-- Price list -->
<record id="product.list0" model="product.pricelist"> <!-- <record id="product.list0" model="product.pricelist">-->
<field name="currency_id" ref="base.CNY"/> <!-- <field name="currency_id" ref="base.CNY"/>-->
</record> <!-- </record>-->
</data> </data>
</odoo> </odoo>

View File

@@ -2,12 +2,12 @@
<odoo> <odoo>
<data noupdate="1"> <data noupdate="1">
<!-- Currencies --> <!-- Currencies -->
<record id="base.USD" model="res.currency"> <!-- <record id="base.USD" model="res.currency">-->
<field name="active" eval="False"/> <!-- <field name="active" eval="False"/>-->
</record> <!-- </record>-->
<record id="base.EUR" model="res.currency"> <!-- <record id="base.EUR" model="res.currency">-->
<field name="active" eval="False"/> <!-- <field name="active" eval="False"/>-->
</record> <!-- </record>-->
<record id="base.CNY" model="res.currency" context="{'lang': 'zh_CN'}"> <record id="base.CNY" model="res.currency" context="{'lang': 'zh_CN'}">
<field name="full_name">人民币</field> <field name="full_name">人民币</field>
<field name="active" eval="True"/> <field name="active" eval="True"/>

View File

@@ -31,7 +31,7 @@ def post_init_hook(cr, registry):
数据初始化,只在安装后执行,更新时不执行 数据初始化,只在安装后执行,更新时不执行
""" """
try: 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([ ids = env['product.category'].sudo().with_context(lang='zh_CN').search([
('parent_id', '!=', False) ('parent_id', '!=', False)
], order='parent_path') ], order='parent_path')
@@ -43,9 +43,24 @@ def post_init_hook(cr, registry):
], 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]) ids = env['res.users'].sudo().with_context(lang='zh_CN').browse([1,2,3,4,5])
ids.write({'tz': "Etc/GMT-8"}) # 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: except Exception as e:
raise Warning(e) raise Warning(e)