Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Getting "null value in column "purchase_warn" violates not-null constraint" error can any one help me please?

By
samba
on 2/13/15, 4:13 AM 678 views

I want to insert a partner while installing my custom module. For this i am writing a data file. My datafile record.

I have tried different ways to give value to purchase_warn field.

first use case:

<record model="res.partner" id="vendor_partner_system_cretaed">
             <field name="name">Vendorportal_system</field>
             <field name="purchase_warn" eval="[(1, ('No Message'))]"/>
        </record>

second use case:

<record model="res.partner" id="vendor_partner_system_cretaed">
             <field name="name">Vendorportal_system</field>
             <field name="purchase_warn" >No Message</field>
        </record>

third use case:

<record model="res.partner" id="vendor_partner_system_cretaed">
             <field name="name">Vendorportal_system</field>
             <field name="purchase_warn" ref="No Message"/>
        </record>

But no use case helps me. Can any one help me where i am doing mistake?

1

zbik

--zbik--
5941
| 6 4 7
Lodz, Poland
--zbik--


zbik
On 2/13/15, 4:44 AM

You try:

        <record model="res.partner" id="vendor_partner_system_cretaed">
             <field name="name">Vendorportal_system</field>
             <field name="purchase_warn">no-message</field>
        </record>

and be sure to add in __openerp__.py the

"depends" : [ ....., "warning" ],

Thank you zbik working fine.

samba
on 2/13/15, 5:16 AM
1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 2/13/15, 4:23 AM

If I'm not mistaken purchase_warn is a selection field with the following entries: [('no-message','No Message'), ('warning','Warning'), ('block','Blocking Message')].  So you should be entering any of the following values into that field: 'no-message', 'warning', 'block', like so: <field name="purchase_warn"/>no-message</field>

Thank you I van. It's working when we write the depends on "warning".

samba
on 2/13/15, 5:22 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/13/15, 4:13 AM
Seen: 678 times
Last updated: 3/16/15, 8:10 AM