fix 17 hooks

This commit is contained in:
Ivan Office
2024-02-26 14:20:30 +08:00
parent cb216a663c
commit d4a6febabc
4 changed files with 18 additions and 19 deletions

View File

@@ -17,14 +17,14 @@
from odoo import api, SUPERUSER_ID
def pre_init_hook(cr):
def pre_init_hook(env):
"""
数据初始化,只在安装时执行,更新时不执行
"""
pass
def post_init_hook(cr, registry):
def post_init_hook(env):
"""
数据初始化,只在安装后执行,更新时不执行
此处不执行,只是记录,该数据已处理完成
@@ -32,8 +32,8 @@ def post_init_hook(cr, registry):
# cr.execute("UPDATE account_account_template set group_id = "
# "(select id from account_group where account_group.code_prefix_start=trim(substring(account_account_template.code from 1 for 1)) limit 1);")
cr.execute("UPDATE account_account set group_id = "
env.cr.execute("UPDATE account_account set group_id = "
"(select id from account_group where account_group.code_prefix_start=trim(substring(account_account.code from 1 for 1)) limit 1);")
cr.commit()
env.cr.commit()
pass