Error in the 'name' column

Asked by mm alam

Hi Every one,

I have experienced that, Whenever I will not give the first column as 'name' openERP give me an error. It is not mandatory, but mostly the error generated is due to this. I have to change the name of the column to 'name' and every thing is alright. Situations exists, when we do not have a column 'name' in the python object. Is it a valid requirement in OpenERP. I understand that certain methods such as name_search() and others are called on the field 'name'

Please shed some light.

Here is the error:

Environment Information :
System : Linux-2.6.31-22-generic-i686-with-Ubuntu-9.10-karmic
OS Name : posix
Distributor ID: Ubuntu
Description: Ubuntu 9.10
Release: 9.10
Codename: karmic
Operating System Release : 2.6.31-22-generic
Operating System Version : #60-Ubuntu SMP Thu May 27 00:22:23 UTC 2010
Operating System Architecture : 32bit
Operating System Locale : en_US.UTF8
Python Version : 2.6.4
OpenERP-Client Version : 5.0.11
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "/home/alam/Downloads/server/bin/netsvc.py", line 247, in dispatch
result = LocalService(service_name)(method, *params)
File "/home/alam/Downloads/server/bin/netsvc.py", line 76, in __call__
return getattr(self, method)(*params)
File "/home/alam/Downloads/server/bin/service/web_services.py", line 577, in execute
res = service.execute(db, uid, object, method, *args)
File "/home/alam/Downloads/server/bin/osv/osv.py", line 58, in wrapper
return f(self, dbname, *args, **kwargs)
File "/home/alam/Downloads/server/bin/osv/osv.py", line 119, in execute
res = pool.execute_cr(cr, uid, obj, method, *args, **kw)
File "/home/alam/Downloads/server/bin/osv/osv.py", line 111, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/home/alam/Downloads/server/bin/osv/orm.py", line 1371, in fields_view_get
xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=context)
File "/home/alam/Downloads/server/bin/osv/orm.py", line 1162, in __view_look_dom_arch
cr.execute('select name, model from ir_ui_view where (id=%s or inherit_id=%s) and arch like %s', (view_id, view_id, '%%%s%%' % field))
File "/home/alam/Downloads/server/bin/sql_db.py", line 77, in wrapper
return f(self, *args, **kwargs)
File "/home/alam/Downloads/server/bin/sql_db.py", line 122, in execute
res = self._obj.execute(query, params)
ProgrammingError: operator does not exist: integer = boolean
LINE 1: select name, model from ir_ui_view where (id=false or inheri...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Question information

Language:
English Edit question
Status:
Answered
For:
Odoo Addons (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Vinay Rana (OpenERP) (vra-openerp) said :
#1

Hello MM Alam ,

If any object do not contain name field then you need to give any other existing field with '_rec_name = "<name of the field >"' option by following way:

class email_template_mailbox(osv.osv):
    _name = "email_template.mailbox"
    _description = 'Email Mailbox'
    _rec_name = "subject"
    _order = "date_mail desc"

    _columns = {
            'email_from':fields.char(
                            'From',
                            size=64),
            'email_to':fields.char(
                            'Recepient (To)',
                            size=250,),
            'email_cc':fields.char(
                            ' CC',
                            size=250),
            'email_bcc':fields.char(
                            ' BCC',
                            size=250),
            'subject':fields.char(
                            ' Subject',
                            size=200,),
            'body_text':fields.text(
                            'Standard Body (Text)'),
            'body_html':fields.text(
                            'Body (Text-Web Client Only)'),
            'attachments_ids':fields.many2many(
                            'ir.attachment',
                            'mail_attachments_rel',
                            'mail_id',
                            'att_id',
                            'Attachments'),
            'account_id' :fields.many2one(
                            'email_template.account',
                            'User account',
                            required=True),
            'user':fields.related(
                            'account_id',
                            'user',
                            type="many2one",
                            relation="res.users",
                            string="User"),
            'server_ref':fields.integer(
                            'Server Reference of mail',
                            help="Applicable for inward items only"),
            'mail_type':fields.selection([
                            ('multipart/mixed',
                             'Has Attachments'),
                            ('multipart/alternative',
                             'Plain Text & HTML with no attachments'),
                            ('multipart/related',
                             'Intermixed content'),
                            ('text/plain',
                             'Plain Text'),
                            ('text/html',
                             'HTML Body'),
                            ], 'Mail Contents'),
            #I like GMAIL which allows putting same mail in many folders
            #Lets plan it for 0.9
            'folder':fields.selection([
                            ('drafts', 'Drafts'),
                            ('outbox', 'Outbox'),
                            ('trash', 'Trash'),
                            ('sent', 'Sent Items'),
                            ], 'Folder', required=True),
            'state':fields.selection([
                            ('na', 'Not Applicable'),
                            ('sending', 'Sending'),
                            ], 'Status', required=True),
            'date_mail':fields.datetime(
                            'Rec/Sent Date'),
            'history':fields.text(
                            'History',
                            readonly=True,
                            store=True)
        }

    _defaults = {
        'state': lambda * a: 'na',
        'folder': lambda * a: 'outbox',
    }

email_template_mailbox()

Hope this will help you.

Thanks.

Can you help with this problem?

Provide an answer of your own, or ask mm alam for more information if necessary.

To post a message you must log in.