Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Property Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

csv import: data with relation

Subscribe

Get notified when there's activity on this post

This question has been flagged
2 Replies
8522 Views
Avatar
Sven Gehr

Hi@all,

I test still various data imports. I do I create a supplier and export these. When I try to import it again I get the error:

null value in column "state" violates not-null constraint in Line 2

In the export-file exists in the the column:

state_id/id

with the value:

__export__.res_partner_58

So there is the field "state" in the parter contact. They are in the table:

res_country_state

searched data set has the id 58.

How can I import this relation?

with best regards Sven

0
Avatar
Discard
Avatar
kaynis
Best Answer

Did you try to import it into another database? If you did, it will tell you just that because you have not created the state_id in the new database. To import into a new database, you will need to export the state name, state_id and the state state_id/id from the first database separately and import it into the new database then when you try again to import the supplier it will not give you this error because the state_id/id would have been added to the database

0
Avatar
Discard
Sven Gehr
Author

I want to import the relation partner -> state. if I e.g. import the german states. I look in the table "res_country" and look for the line with germany. I realize the id and write it in the colum "country_id" in my german_stats.csv. After the import openerp show me all german stats with the relation to germany. Why does that not work for the relation partner to the state?

kaynis

have you imported the states already?

Sven Gehr
Author

yes states are in the table. I can view with pgadmin and locate the id

kaynis

Export the states alone and get their ids without the countries. Then use these ids instead. That should work. When you import the states OpenERP generates ids them. Alternatively you can import state_id instead which are the names of the states and don't import state_id/id

Sven Gehr
Author

I have no ids in the csv file (states.csv) used. Only

code,name,country_id BW,Baden-Württemberg,58 BY,Bayern,58 ....

kaynis

something like __export__.res_partner_58 is an Id plus if you are importing the state and you already have the state_id/id you should not import the state column anymore unless you have all the right states filled. Omit the state column and try again with only state_id/id. if you export the state names only the first column in the export csv usually have the id for each state name

Avatar
Sven Gehr
Author Best Answer

the 58 was just an example. The question is what value should I put in the csv file into the column?

0
Avatar
Discard
kaynis

Better if you don't import that column if you don't have any value there. set the column as don't import also do the same to the state_id. the csv will import because these fields are not required fields for supplier. The only required field in supplier is the name field. the other can be excluded during import.

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

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

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 Svenska ภาษาไทย 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