base
或
account
模块一切正常,因为如果我对模块进行新的更改,我希望将来升级数据库。
account.acount.type
. 但是当我尝试升级
账户
模块中,出现了写在该问题底部的异常。奥多正试图从该模型中删除记录。为什么会这样?
expected behaviour of upgrading modules with data is
:
noupdate表示当第二次升级此模块时,此记录将不会再次更新。noupdate=“1”中的记录将仅在安装时初始化。
提示
:如果删除记录,则在下次更新时,系统将重新创建该记录。通常是那些有可能从前端修改的记录,在noupdate=1中给出。例如,自动计划程序记录。
<data noupdate="1">
<!-- account.account.type -->
<record model="account.account.type" id="data_account_type_receivable">
<field name="name">Receivable</field>
<field name="type">receivable</field>
<field name="include_initial_balance" eval="True"/>
</record>
<!-- [...] -->
这是升级帐户模块时在日志上引发的错误
2018-12-11 20:35:31,729 18018 INFO db_name odoo.addons.base.ir.ir_model: Deleting 59@account.account.type (l10n_es.account_type_third_parties)
2018-12-11 20:35:31,760 18018 ERROR db_name odoo.sql_db: bad query: b'DELETE FROM account_account_type WHERE id IN (59)'
ERROR: null value in column "user_type_id" violates not-null constraint
DETAIL: Failing row contains (14927, Account name or description, null, 4, f, null, other, null, f, null, 1, null, 1, 2018-12-11 18:10:24.091826, 1, 2018-12-11 18:10:24.091826, t).
CONTEXT: SQL statement "UPDATE ONLY "public"."account_account" SET "user_type_id" = NULL WHERE $1 OPERATOR(pg_catalog.=) "user_type_id""
2018-12-11 20:35:31,763 18018 WARNING db_name odoo.modules.loading: Transient module states were reset
2018-12-11 20:35:31,763 18018 ERROR db_name odoo.modules.registry: Failed to load registry
Traceback (most recent call last):
File "/path/to/odoo/src/modules/registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/path/to/odoo/src/modules/loading.py", line 414, in load_modules
env['ir.model.data']._process_end(processed_modules)
File "/path/to/odoo/src/linked/base/ir/ir_model.py", line 1628, in _process_end
record.unlink()
File "/path/to/odoo/src/models.py", line 2935, in unlink
cr.execute(query, (sub_ids,))
File "/path/to/odoo/src/sql_db.py", line 155, in wrapper
return f(self, *args, **kwargs)
File "/path/to/odoo/src/sql_db.py", line 232, in execute
res = self._obj.execute(query, params)
psycopg2.IntegrityError: null value in column "user_type_id" violates not-null constraint
This is raised because the account type is being used by some account.
笔记
:我已从零开始手动导入科目表