Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

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

Naroči se

Get notified when there's activity on this post

This question has been flagged
accountinglocalizationschemaodoo18
1 Odgovori
1612 Prikazi
Avatar
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
Avatar
Opusti
Avatar
D Enterprise
Best Answer
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
Avatar
Opusti
RGonzalez
Avtor

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

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Issue with the "Pay" Button Visibility After Full Invoice Payment in Odoo
accounting odoo18
Avatar
Avatar
Avatar
2
avg. 25
2378
Error about localization when installing accounting app Solved
accounting localization
Avatar
Avatar
Avatar
3
maj 25
3373
[l10n_mx] ¿Puedo descargar el Acuse de Cancelación de una Factura? Solved
accounting localization mexico
Avatar
Avatar
2
okt. 25
1840
[l10n_mx] - Error CFDI40130 No puedo facturar a Público en General Solved
accounting localization mexico
Avatar
Avatar
Avatar
3
sep. 25
1507
I can't change fiscal localization package Solved
accounting localization quickstart
Avatar
1
jun. 25
7247
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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