Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

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

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
accountinglocalizationschemaodoo18
1 Răspunde
1621 Vizualizări
Imagine profil
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
Imagine profil
Abandonează
Imagine profil
D Enterprise
Cel mai bun răspuns
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
Imagine profil
Abandonează
RGonzalez
Autor

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!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Issue with the "Pay" Button Visibility After Full Invoice Payment in Odoo
accounting odoo18
Imagine profil
Imagine profil
Imagine profil
2
aug. 25
2394
Error about localization when installing accounting app Rezolvat
accounting localization
Imagine profil
Imagine profil
Imagine profil
3
mai 25
3389
[l10n_mx] ¿Puedo descargar el Acuse de Cancelación de una Factura? Rezolvat
accounting localization mexico
Imagine profil
Imagine profil
2
oct. 25
1848
[l10n_mx] - Error CFDI40130 No puedo facturar a Público en General Rezolvat
accounting localization mexico
Imagine profil
Imagine profil
Imagine profil
3
sept. 25
1514
I can't change fiscal localization package Rezolvat
accounting localization quickstart
Imagine profil
1
iun. 25
7269
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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