コンテンツへスキップ
Odoo メニュー
  • サインイン
  • 無料で15日試す
  • アプリ
    財務
    • 会計
    • 請求
    • 経費
    • スプレッドシート(BI)
    • ドキュメント管理
    • 署名
    販売
    • CRM
    • 販売
    • POS店舗
    • POSレストラン
    • サブスクリプション
    • レンタル
    ウェブサイト
    • ウェブサイトビルダー
    • eコマース
    • ブログ
    • フォーラム
    • ライブチャット
    • eラーニング
    サプライチェーン
    • 在庫
    • 製造
    • 製品ライフサイクル管理 (PLM)
    • 購買
    • 整備
    • 品質
    人事業務
    • 従業員管理
    • 採用
    • 休暇管理
    • 人事評価
    • リファラル
    • フリート
    マーケティング
    • ソーシャルマーケティング
    • メールマーケティング
    • SMSマーケティング
    • イベント
    • マーケティングオートメーション
    • アンケート調査
    サービス
    • プロジェクト管理
    • タイムシート
    • フィールドサービス
    • ヘルプデスク
    • 計画
    • アポイントメント
    生産性向上ツール
    • ディスカッション
    • 承認
    • IoT
    • VoIP
    • ナレッジ
    • WhatsApp
    サードパーティアプリ Odooスタジオ Odooクラウドプラットホーム
  • インダストリー(業種別ソリューション)
    小売
    • 書店
    • アパレルショップ
    • 家具専門店
    • 食料品店
    • 金物店
    • 玩具店
    飲食・ホスピタリティ業界
    • バー・パブ
    • レストラン
    • ファストフード
    • ゲストハウス
    • 飲料販売代理店
    • ホテル
    不動産
    • 不動産会社
    • 建築事務所
    • 建設
    • 不動産管理
    • 造園
    • 住宅所有者組合
    コンサルティング
    • 会計事務所
    • Odooパートナー
    • マーケティングエージェンシー
    • 法律事務所
    • 人材派遣
    • 監査・認証
    製造
    • テキスタイル
    • 金属
    • 家具
    • 飲食
    • 醸造所
    • コーポレートギフト
    ヘルス & フィットネス
    • スポーツクラブ
    • 眼鏡店
    • フィットネスセンター
    • ウェルネス専門家
    • 薬局
    • ヘアサロン
    業種
    • 便利屋
    • IT ハードウェア・サポート
    • 太陽エネルギーシステム
    • 靴メーカー
    • クリーニングサービス
    • 空調設備サービス
    その他
    • 非営利団体
    • 環境機関
    • ビルボードレンタル
    • 写真
    • 自転車リース
    • ソフトウェアリセラー
    すべての業種を見る
  • コミュニティ
    学ぶ
    • チュートリアル
    • ドキュメンテーション
    • 認定
    • トレーニング
    • ブログ
    • ポッドキャスト
    教育サポート
    • 教育プログラム
    • Scale Up! ビジネスゲーム
    • Odooオフィス訪問
    ソフトを入手
    • ダウンロード
    • エディションを比較
    • リリース
    コラボレーション
    • Github
    • フォーラム
    • イベント
    • 翻訳
    • パートナーになる
    • パートナー様向けサービス
    • 会計事務所を登録
    サービス利用
    • パートナー一覧
    • 会計事務所一覧
    • 今すぐ相談する
    • 導入支援サービス
    • お客様一覧
    • サポート
    • アップグレード
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    製品デモを利用する
  • 料金
  • ヘルプ

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • 会計
  • 在庫
  • PoS
  • プロジェクト
  • MRP
All apps
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
コミュニティで交流するには登録する必要があります。
全てのポスト 人々 バッジ
タグ (全て表示)
odoo accounting v14 pos v15
このフォーラムについて
ヘルプ

Field create_asset is not specified, but when doing so, it says the field is invalid

購読

この投稿に活動があった際に通知を受け取ります

この質問にフラグが付けられました
accountinglocalizationschemaodoo18
1 返信
1511 ビュー
アバター
RGonzalez

Hello everyone, I hope you are all well.


I'm trying to import records via a CSV file, specifically from the account.account template, but when I run the module, I get the following error:


psycopg2.errors.NotNullViolation: null value in column "create_asset" of relation "account_account" violates not-null constraint

DETAIL: Failing row contains (284, null, 1, 1, asset_cash, {"en_US": "Caja Principal"}, null, null, f, f, f, 2025-06-05 15:41:55.655359, 2025-06-05 15:41:55.655359, null, null, null).


During handling of the above exception, another exception occurred:


Traceback (most recent call last): 

File "/home/odoo/src/odoo/odoo/service/server.py", line 1328, in preload_registries 

registry = Registry.new(dbname, update_module=update_module) 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/usr/lib/python3/dist-packages/decorator.py", line 232, in fun 

return caller(func, *(extras + args), **kw) 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/tools/func.py", line 97, in locked 

return func(inst, *args, **kwargs) 

^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/modules/registry.py", line 127, in new 

odoo.modules.load_modules(registry, force_demo, status, update_module) 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 480, in load_modules 

processed_modules += load_marked_modules(env, graph, 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 365, in load_marked_modules 

loaded, processed = load_module_graph( 

^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 228, in load_module_graph 

load_data(env, idref, mode, kind='data', package=package) 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 72, in load_data 

tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind) 

File "/home/odoo/src/odoo/odoo/tools/convert.py", line 604, in convert_file 

convert_csv_import(env, module, pathname, fp.read(), idref, mode, noupdate) 

File "/home/odoo/src/odoo/odoo/tools/convert.py", line 646, in convert_csv_import 

result = env[model].with_context(**context).load(fields, datas) 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/models.py", line 1429, in load 

flush() 

File "/home/odoo/src/odoo/odoo/models.py", line 1378, in flush 

messages.append(dict(info, type='error', **PGERROR_TO_OE[e.pgcode](self, fg, info, e)))

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/odoo/src/odoo/odoo/models.py", line 7539, in convert_pgerror_not_null

field = fields[field_name]

~~~~~~^^^^^^^^^^^^

KeyError: 'create_asset'


I investigate and see that the value "no" can be assigned, since there are other records of the same model, so I adjust the structure:

id,code,name,account_type,reconcile,create_asset

l10n_ve_chart_account_cta_1_1_1_01_01,1.1.1.01.01,Main Cash,asset_cash,False,no

l10n_ve_chart_account_cta_1_1_1_01_02,1.1.1.01.02,Caja Chica Bolivares,asset_cash,True,no


And when I compile the module:


Traceback (most recent call last): 

File "/home/odoo/src/odoo/odoo/service/server.py", line 1328, in preload_registries 

registry = Registry.new(dbname, update_module=update_module) 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/usr/lib/python3/dist-packages/decorator.py", line 232, in fun 

return caller(func, *(extras + args), **kw) 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/tools/func.py", line 97, in locked 

return func(inst, *args, **kwargs) 

^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/modules/registry.py", line 127, in new 

odoo.modules.load_modules(registry, force_demo, status, update_module) 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 480, in load_modules 

processed_modules += load_marked_modules(env, graph, 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 365, in load_marked_modules 

loaded, processed = load_module_graph( 

^^^^^^^^^^^^^^^^^^ 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 228, in load_module_graph 

load_data(env, idref, mode, kind='data', package=package) 

File "/home/odoo/src/odoo/odoo/modules/loading.py", line 72, in load_data 

tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind) 

File "/home/odoo/src/odoo/odoo/tools/convert.py", line 604, in convert_file 

convert_csv_import(env, module, pathname, fp.read(), idref, mode, noupdate) 

File "/home/odoo/src/odoo/odoo/tools/convert.py", line 646, in convert_csv_import 

result = env[model].with_context(**context).load(fields, datas) 

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File "/home/odoo/src/odoo/odoo/models.py", line 1418, in load

for id, xid, record, info in converted:

File "/home/odoo/src/odoo/odoo/models.py", line 1599, in _convert_records

for stream_index, (record, extras) in enumerate(records):

File "/home/odoo/src/odoo/odoo/models.py", line 1484, in _extract_records

raise ValueError(f'Invalid field name {fname!r}')

ValueError: Invalid field name 'create_asset'


So, if I don't include it, it tells me the value is missing, but if I include it, it tells me the field is invalid.


I appreciate the advice on how to correctly import the accounting accounts I want to set up for a location. Thank you very much.

0
アバター
破棄
アバター
D Enterprise
最善の回答
Hii,

Problem Explained:
  • The account_account table in the database has a column called create_asset, and it is NOT NULL.
  • However, the account.account model in Python (in your Odoo version) does not expose this field, or at least not under that name.
  • That’s why:
    • If you omit it: you get null value violates not-null constraint.
    • If you include it: you get Invalid field name 'create_asset'.

This is a low-level field that is used by the account assets module.

Simple Solution:

Add this column to your CSV file:
..., create_asset_type

..., none

  • The correct field name is usually: create_asset_type
  • Valid values:
    • none (default — no asset created)
    • manual
    • draft
This field is exposed and maps internally to create_asset logic.

Example Corrected CSV:

id,code,name,account_type,reconcile,create_asset_type

l10n_ve_chart_account_cta_1_1_1_01_01,1.1.1.01.01,Main Cash,asset_cash,False,none

l10n_ve_chart_account_cta_1_1_1_01_02,1.1.1.01.02,Caja Chica Bolivares,asset_cash,True,none


i hope it is use full

0
アバター
破棄
RGonzalez
著作者

Hello, I hope you're well. Thank you for your prompt responses.

Unfortunately, when I made the changes you mentioned, that create_asset_type field was also invalid, and I got the exact same error.

Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/service/server.py", line 1328, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/odoo/src/odoo/odoo/tools/func.py", line 97, in locked
return func(inst, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/odoo/src/odoo/odoo/modules/registry.py", line 127, in new
odoo.modules.load_modules(registry, force_demo, status, update_module)
File "/home/odoo/src/odoo/odoo/modules/loading.py", line 480, in load_modules
processed_modules += load_marked_modules(env, graph,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/odoo/src/odoo/odoo/modules/loading.py", line 365, in load_marked_modules
loaded, processed = load_module_graph(
^^^^^^^^^^^^^^^^^^
File "/home/odoo/src/odoo/odoo/modules/loading.py", line 228, in load_module_graph
load_data(env, idref, mode, kind='data', package=package)
File "/home/odoo/src/odoo/odoo/modules/loading.py", line 72, in load_data
tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind)
File "/home/odoo/src/odoo/odoo/tools/convert.py", line 604, in convert_file
convert_csv_import(env, module, pathname, fp.read(), idref, mode, noupdate)
File "/home/odoo/src/odoo/odoo/tools/convert.py", line 646, in convert_csv_import
result = env[model].with_context(**context).load(fields, datas)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/odoo/src/odoo/odoo/models.py", line 1418, in load
for id, xid, record, info in converted:
File "/home/odoo/src/odoo/odoo/models.py", line 1599, in _convert_records
for stream_index, (record, extras) in enumerate(records):
File "/home/odoo/src/odoo/odoo/models.py", line 1484, in _extract_records
raise ValueError(f'Invalid field name {fname!r}')
ValueError: Invalid field name 'create_asset_type'

Unlike the previous field, I can't find a reference to this one either in the field list or in the source code.

create_asset = fields.Selection([('no', 'No'), ('draft', 'Create in draft'), ('validate', 'Create and validate')],
required=True, default='no', tracking=True)

I checked to see if there was any calculation for the create_asset field, but it's a simple field with no built-in calculation. I looked at the l10n_ve module to see how they uploaded the accounts, and they didn't even mention the field. create_asset, and if I compile this installed module, everything works perfectly; however, they don't import the data from the manifest, but rather have the CSV files inside data/template, and somehow I don't understand yet, the data is loaded.

D Enterprise

Use a Post-init Hook to Set Default for create_asset
Since:

You cannot import create_asset via CSV (ValueError)

It's a required field (NOT NULL constraint)

The official solution uses post-processing, not direct CSV

The cleanest and safest method is to add a post-init hook that sets the default value after importing your records.
Add this in your __manifest__.py:
'post_init_hook': 'set_default_create_asset',
Create post_init_hook.py file in your module:
from odoo import SUPERUSER_ID, api

def set_default_create_asset(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
env['account.account.template'].search([('create_asset', '=', False)]).write({'create_asset': 'no'})
Now: Your CSV can be like this (without create_asset):
id,code,name,account_type,reconcile
l10n_ve_chart_account_cta_1_1_1_01_01,1.1.1.01.01,Main Cash,asset_cash,False
l10n_ve_chart_account_cta_1_1_1_01_02,1.1.1.01.02,Caja Chica Bolivares,asset_cash,True
i hope this way is helpfull

ディスカッションを楽しんでいますか?読むだけでなく、参加しましょう!

今すぐアカウントを作成して、限定機能を利用したり、素晴らしいコミュニティと交流しましょう!

登録
関連投稿 返信 ビュー 活動
Issue with the "Pay" Button Visibility After Full Invoice Payment in Odoo
accounting odoo18
アバター
アバター
アバター
2
8月 25
2275
Error about localization when installing accounting app 解決済
accounting localization
アバター
アバター
アバター
3
5月 25
3247
[l10n_mx] ¿Puedo descargar el Acuse de Cancelación de una Factura? 解決済
accounting localization mexico
アバター
アバター
2
10月 25
1751
[l10n_mx] - Error CFDI40130 No puedo facturar a Público en General 解決済
accounting localization mexico
アバター
アバター
アバター
3
9月 25
1351
I can't change fiscal localization package 解決済
accounting localization quickstart
アバター
1
6月 25
7113
コミュニティ
  • チュートリアル
  • ドキュメンテーション
  • フォーラム
オープンソース
  • ダウンロード
  • Github
  • Runbot
  • 翻訳
サービス
  • Odoo.shホスティング
  • サポート
  • アップグレード
  • カスタム開発
  • 教育プログラム
  • 会計事務所一覧
  • パートナー一覧
  • パートナーになる
企業情報
  • 会社概要
  • ブランドアセット
  • お問い合わせ
  • 採用情報
  • イベント
  • ポッドキャスト
  • ブログ
  • お客様一覧
  • リーガル情報 • プライバシーポリシー
  • セキュリティ
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo(オドゥー)は、CRM、eコマース、会計、在庫管理、POS、プロジェクト管理など、企業のさまざまな業務を一つのシステムで管理できる、ベルギー発のオープンソースのERPソフトウェアです。

高機能で使いやすく、完全に統合されたERPとして、ユニークな価値を提供しています。

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now