Odoo Help


Form view is not using field in generated SQL [Closed]

Seth Boyd
on 3/15/14, 9:24 PM 2,269 views

The Question has been closed

Ray Carnes
on 03/16/2014 13:41:19

I've created a simple extended product model that I'm not trying to use in a form view. The creation view renders properly, but when I try and save the new object I receive an error about not filling out a required field on my model, "name". I did fill this field out, though, so I'm not sure where the problem is coming from.

Here is the pertinent code

My Model:

class product_product(osv.Model):
    _inherit = "product.product"
    _columns = {
        'ismeetingroom':fields.boolean('Is Meeting Room'),
        'ismeetingroomextra': fields.boolean('Is Meeting Room Amenity'),


class hotel_meetingroom(osv.Model):
    _name = "hotel.meetingroom"
    _inherits = {'product.product': 'product_id'}
    _description = "Hotel Meeting Room"
    _columns = {
        'product_id': fields.many2one('product.product', 'Product_id', required=True, ondelete='cascade'),
        'name':fields.char('Meeting Room Name', size=64, required=True),
    _defaults = {
        'ismeetingroom': 1,
        'ismeetingroomextra': 0,


My View which I've really simplified:

<record model="ir.ui.view" id="view_hotel_meetingroom_form">
    <field name="name">hotel.meetingroom.form</field>
    <field name="model">hotel.meetingroom</field>
    <field name="arch" type="xml">
        <form string="Hotel Meeting Meeting Room" version="7.0">
                <field name="name" select="1"/>

And the traceback from my server log:

2014-03-15 23:36:31,102 31318 ERROR test-demo-data openerp.sql_db: bad query: insert into "product_template" (id,"supply_method","list_price","standard_price","mes_type","uom_id","cost_method","categ_id","uos_coeff","sale_delay","procure_method","sale_ok","produce_delay","company_id","uom_po_id","rental","type",create_uid,create_date,write_uid,write_date) values (81,'buy','1.00','0.00','fixed',1,'standard',1,'1.000',7.0,'make_to_stock','True',1.0,1,1,'False','consu',1,(now() at time zone 'UTC'),1,(now() at time zone 'UTC'))
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
IntegrityError: null value in column "name" violates not-null constraint
2014-03-15 23:36:31,109 31318 ERROR test-demo-data openerp.netsvc: Integrity Error
The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set
[object with reference: name - name]
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 292, in dispatch_rpc
    result = ExportService.getService(service_name).dispatch(method, params)
  File "/usr/lib/pymodules/python2.7/openerp/service/web_services.py", line 626, in dispatch
    res = fn(db, uid, *params)
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 190, in execute_kw
    return self.execute(db, uid, obj, method, *args, **kw or {})
  File "/usr/lib/pymodules/python2.7/openerp/osv/osv.py", line 174, in wrapper
    netsvc.abort_response(1, _('Integrity Error'), 'warning', msg)
  File "/usr/lib/pymodules/python2.7/openerp/netsvc.py", line 71, in abort_response
    raise openerp.osv.osv.except_osv(description, details)
except_osv: ('Integrity Error', 'The operation cannot be completed, probably due to the following:\n- deletion: you may be trying to delete a record while other records still reference it\n- creation/update: a mandatory field is not correctly set\n\n[object with reference: name - name]')

I'm sure I must be doing something wrong, but I just can't figure it out.


Ray Carnes

--Ray Carnes--
| 9 7 9
Keyport, United States
--Ray Carnes--

Senior ERP Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0 and 11.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
On 3/16/14, 1:18 AM

Your new model requires a value for product_id which itself requires a name field. If you show the field product_id in your view I suspect you will see it is blank, waiting for a value.

Thanks! That was indeed the problem. I removed the name field, which isn't necessary if the product stores it, and everything works fine now.

Seth Boyd
on 3/16/14, 11:45 AM

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 3/15/14, 9:24 PM
Seen: 2269 times
Last updated: 3/16/15, 8:10 AM