0

我在尝试为默认情况下没有帐户模块的国家/地区创建帐户图表时遇到数据库错误。模块安装正确。配置的所有税款似乎都很好,并且会计科目表反映了我account.acount.template.csv档案中的内容。但是,通过我的终端日志,我可以看到在加载上述 csv 文件时,会发生此错误

2021-03-16 18:32:27,054 68271 INFO testing odoo.modules.loading: loading l10n_foo/data/account.account.template.csv
ERROR testing odoo.sql_db: bad query: 
            INSERT INTO ir_model_data (module, name, model, res_id, noupdate)
            VALUES ('l10n_foo', '10210011', 'account.account.template', 3, false),   
                   ('l10n_foo', '10210012', 'account.account.template', 4, false), 
                    .
                    . 
                    .
                   ('l10n_foo', '10210018', 'account.account.template', 10, false)

ON CONFLICT (module, name)
        DO UPDATE SET (model, res_id, write_date) =
            (EXCLUDED.model, EXCLUDED.res_id, now() at time zone 'UTC')
            
    
ERROR: ON CONFLICT DO UPDATE command cannot affect row a second time
HINT:  Ensure that no rows proposed for insertion within the same command 
       have duplicate constrained values.
 
2021-03-16 18:27:21,500 68271 ERROR testing odoo.addons.base.models.ir_model: Failed to insert ir_model_data
('l10n_foo', '1002010', 'account.account.template', 3, False)
('l10n_foo', '1002011', 'account.account.template', 4, False)
...

什么可能导致此错误?

4

1 回答 1

1

您的account.acount.template.csv文件中有重复的行,

所以请检查并删除任何一行。

谢谢

于 2021-03-17T02:03:18.710 回答