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
    • Estate 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

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
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

Creating a custom product.product by demo xml file?

Subscribe

Get notified when there's activity on this post

This question has been flagged
salesproductdemodata
11 Replies
11254 Views
Avatar
Tihomir Stoychev Stoychev

Hello Team im trying to create a product but by xml file, i know its possible but its giving me the next error : 


odoo.tools.convert.ParseError: "null value in column "purchase_line_warn" violates not-null constraint

DETAIL:  Failing row contains (88, Valencia Product, 1, null, null, null, service, f, 1, 1.00, null, null, t, t, 1, 1, 1, t, null, null, null, null, 1, 2019-01-17 10:52:47.369262, 1, 2019-01-17 10:52:47.369262, manual, no-message, null, no, order, 1, 0, none, null, null, null, null, null, null, null, null, null).

My code is the following:

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record
model="product.product" id="hotels_be_bago.product1">
<field
name="name">Valencia Product</field>
<field
name="type">service</field>
<field
name="purchase_line_warn">1</field>
<field
name="sale_line_warn">no-message</field>
</record>

</data>
</odoo>
Why is telling me that is null when i have value 1 set on it?

Thanks for the help    
1
Avatar
Discard
Avatar
Rakesh Vadeghar
Best Answer

I solved this error by putting 'depends': ['sale'], in manifest file

2
Avatar
Discard
Mohamed Bessou

Thanks that works

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

The error message says that the field named "purchase_line_warn" is not getting the value and it is a required field, so it is mandatory to supply the value for that field.
Checking your data file, it seems you have given 1 for the field purchase_line_warn . The value that can be accepted by this field are 'no-message' ,  'warning' or 'block'



Sample,

<odoo>
<data noupdate="1">
<record model="product.product" id="hotels_be_bago.product1">
<field name="name">Valencia Product</field>
<field name="type">service</field>
<field name="purchase_line_warn">warning</field>
<field name="sale_line_warn">no-message</field>
</record>

</data>
</odoo>

So update the code accordingly and try. Once everything is okay, give noupdate="1" for the data file.


Thanks

1
Avatar
Discard
Tihomir Stoychev Stoychev
Author

odoo.tools.convert.ParseError: "null value in column "purchase_line_warn" violates not-null constraint

DETAIL: Failing row contains (96, Valencia Product, 1, null, null, null, service, f, 1, 1.00, null, null, t, t, 1, 1, 1, t, null, null, null, null, 1, 2019-01-17 11:10:42.859666, 1, 2019-01-17 11:10:42.859666, manual, no-message, null, no, order, 1, 0, none, null, null, null, null, null, null, null, null, null).

" while parsing /var/lib/odoo/modules/hotels_be_bago/demo/demoProducto.xml:4, near

<record model="product.product" id="hotels_be_bago.product1">

<field name="name">Valencia Product</field>

<field name="type">service</field>

<field name="purchase_line_warn">warning</field>

<field name="sale_line_warn">no-message</field>

</record>

Cybrosys Techno Solutions Pvt.Ltd

Can you check the same in new db also change the id of the record to 'custom_pro1' and see

Tihomir Stoychev Stoychev
Author

Keeps saying the same even i changed the db and the id

odoo.tools.convert.ParseError: "null value in column "purchase_line_warn" violates not-null constraint

DETAIL: Failing row contains (102, Valencia Product, 1, null, null, null, service, f, 1, 1.00, null, null, t, t, 1, 1, 1, t, null, null, null, null, 1, 2019-01-17 12:10:23.841209, 1, 2019-01-17 12:10:23.841209, manual, no-message, null, no, order, 1, 0, none, null, null, null, null, null, null, null, null, null).

" while parsing /var/lib/odoo/modules/hotels_be_bago/demo/demoProducto.xml:4, near

<record model="product.product" id="custom_pro1">

<field name="name">Valencia Product</field>

<field name="type">service</field>

<field name="purchase_line_warn">warning</field>

<field name="sale_line_warn">no-message</field>

</record>

Reinhart

Have you managed to solve this?

Avatar
Guillaume Seran
Best Answer

Hello,

this error message appear if you have already installed your module !

If you uninstalled and installed your module you will not have an error!

1
Avatar
Discard
Avatar
Kevin Cardona
Best Answer

I solved it adding to the _manifest__.py on the "depends" key the purchase module, seems like odoo creates like an "environment" when updating a module and that environment only has whatever the depends key value in the manifest  indicates, so if you have installed the purchase module and then you reinstall a module that creates a new product and you dont have added in the key depends the purchase module, it will not detect all the fields that purchase have added, in this specific case purchase_line_warn, and since the field has a not null constraint the database will raise an exception.

I dont know why odoo developed like this, but not seems to be good. Hope this helps someone who affronts this problem too.


0
Avatar
Discard
Avatar
Reinhart
Best Answer

I'm having the same probem, didn't even have the warning config activated, but seems is a base field, but:

<field name="purchase_line_warn">no-message</field>

doesn't work at all.

Also the field is declared with a default 'no-message' value :

    purchase_line_warn = fields.Selection(WARNING_MESSAGE, 'Purchase Order Line', help=WARNING_HELP, required=True, default="no-message")

Shouldn't take the default value if the field is missed?

0
Avatar
Discard
Avatar
Maks
Best Answer

He is right (guy whit kung-fu panda image. Odoo forum is so pathetic that I cannot comment his post or address him in mine)! I had the same issue. If you want to keep updating your module, you have to add noupdate='1' in data tag, but remember that after this everything in this data tag will not be updated while module update.

0
Avatar
Discard
Avatar
Tihomir Stoychev Stoychev
Author Best Answer

It tells me the same...


odoo.tools.convert.ParseError: "null value in column "purchase_line_warn" violates not-null constraint

DETAIL:  Failing row contains (96, Valencia Product, 1, null, null, null, service, f, 1, 1.00, null, null, t, t, 1, 1, 1, t, null, null, null, null, 1, 2019-01-17 11:10:42.859666, 1, 2019-01-17 11:10:42.859666, manual, no-message, null, no, order, 1, 0, none, null, null, null, null, null, null, null, null, null).

" while parsing /var/lib/odoo/modules/hotels_be_bago/demo/demoProducto.xml:4, near

<record model="product.product" id="hotels_be_bago.product1">

<field name="name">Valencia Product</field>

<field name="type">service</field>

<field name="purchase_line_warn">warning</field>

<field name="sale_line_warn">no-message</field>

</record>


0
Avatar
Discard
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
Related Posts Replies Views Activity
Conditionally show or hide product attributes (Odoo Online/Studio)
sales product
Avatar
Avatar
1
Oct 25
803
Hide the cost
sales product
Avatar
Avatar
Avatar
2
May 25
4605
Products in multi company
sales product
Avatar
0
Nov 24
1571
how to filter out all products which got no sales with the last 3 months or a specific period?
sales product
Avatar
Avatar
1
Aug 24
2420
Difference between Product Type and Product Category Solved
sales product
Avatar
Avatar
1
Aug 24
4595
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 ภาษาไทย 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