Odoo Help


Programming error when trying to relate a custom module to crm.lead

Eric Geens
on 7/10/14, 6:11 PM 563 views

I created a simple module crm.notesattach (related to crm.lead) with the following model :


class crm_notesattach(osv.Model) :

    _name = 'crm.notesattach'
    _description = 'Notes and Attachments'
    _rec_name = 'subject'
    _columns = {
         'subject': fields.char('Summary', size = 255),
         'note_date': fields.datetime('Date'),
        'opportunity_id': fields.many2one('crm.lead', 'ID', readonly = True),
        'partner_id': fields.many2one('res.partner', 'Customer'),
        'user_id' : fields.many2one('res.users', 'Owner'),
        'type': fields.selection([('meeting','Meeting minutes'),('intern','Internal note'),('back','Background info'),('comment','Additional comments'),('other','Other')], 'Type'),
        'body': fields.html('Contents'),
        'has_attach': fields.boolean('Include attachment'),
#        'attachments_ids': fields.many2many('ir.attachment', string="Add an attachment"),
        'note_date': fields.datetime.now,
        'user_id': lambda self,cr,uid,ctx: uid,


When I install the module, I get the following error :

Programming Error : There is no reference field 'id' found for 'crm.notesattach'

When I change the 'opportunity_id' to 'id' (as in crm.lead), then the module installs but when I try to save the lines, I'll get another error :

ProgrammingError: column specified more than once LINE 1: ...rm_notesattach" (id,"user_id","has_attach","type","id","note...

I've been looking around on various forums but didn't find any answer... Has anyone an idea ? Maybe I'm just overlooking something.

Thanks for any suggestion to solve this.

Eric Geens
On 7/10/14, 6:59 PM

Sorry, I've got it working.

It was caused by conflicting 'id's...

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 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: 7/10/14, 6:11 PM
Seen: 563 times
Last updated: 3/16/15, 8:10 AM