Odoo Help

0

How to resolve the below Programming Error?

By
babu
on 6/16/14, 9:51 AM 814 views

Hi to All,

I am new to Openerp i am getting this below error

ProgrammingError: column crm_new_report.id does not exist LINE 1: SELECT "crm_new_report".id FROM "crm_new_report" ORDER... 

 

My code is :

 

    def init(self, cr):

        """
            Crm analysis
            @param cr: the current row, from the database cursor
        """
        tools.drop_view_if_exists(cr, 'crm_new_report')
        cr.execute("""
         CREATE OR REPLACE VIEW crm_new_report AS (
                SELECT tick_id, name, create_date, date_closed FROM crm_claim
            )""")

    def unlink(self, cr, uid, ids, context=None):
        raise osv.except_osv(_('Error!'), _('You cannot delete any record from report section!'))

 

Any one can Please rectify me, what I did mistake here.

 

Thanks in Advance.....

 

0
Saloua ELKHOUFAIRI
On 4/29/15, 6:36 AM

hi
plz could you tell me how do you call the init function? it is called automatically in the initialisation of the model or you call it through another button?
best regards

0
babu
On 6/16/14, 11:52 AM

Thanks Raphael Collet. It is working fine now, Have a nice day...

0
Raphael Collet (rco)
On 6/16/14, 10:58 AM

The ORM is trying to access the records in the table 'crm_new_report'. In order to do this, it expects that table to have a column called 'id' (all Odoo models have this). So your view must define a unique 'id' for each row.

In your case, an easy fix is to reuse the id of 'crm_claim':

CREATE OR REPLACE VIEW crm_new_report AS (
                SELECT id, tick_id, name, create_date, date_closed FROM crm_claim
            )

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.

Register

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)

Stats

Asked: 6/16/14, 9:51 AM
Seen: 814 times
Last updated: 4/29/15, 7:27 AM