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

Inherit crm_lead_report

By
thorfinn
on 8/19/14, 3:33 AM 632 views

Hi,

I try to override the model crm.lead.report

But my field doesn't appear in the database

This is my python code


from openerp.osv import orm, fields

class account_invoice_report(orm.Model):
    _inherit = 'crm.lead.report'
   

    _columns = {
        'other_turnover': fields.float('Other turnover'),
    }

 

Anyone have an idea?

0
thorfinn
On 8/20/14, 9:35 AM

It's possible to add the column in python code. I tried this but it's not ok

    def init(self, cr):
        tools.drop_view_if_exists(cr, 'crm_lead_report')
        cr.execute("""
            CREATE OR REPLACE VIEW crm_lead_report AS (
                SELECT

                    c.other_turnover,

                FROM
                    crm_lead c
                WHERE c.active = 'true'
            )""")

In custom module copy and paste the original CRM report query and add your extra field c.other_turnover.

Prakash
on 8/21/14, 8:05 AM
0

Prakash

--Prakash--
3173
| 5 4 7
Bikaner, India
--Prakash--

OpenERP Devloper at SunARC Technology

Prakash
On 8/19/14, 8:21 AM

crm_lead_report is a VIEW defines a view of a query.  If you want to shows 'other_turnover' in the crm_lead_report view then add the column in sql query in the python file and define in xml file.

Refer:  Default  CRM, Sale, Purchase, Account Module Report File.

Postgresql View Document:-  http://www.postgresql.org/docs/9.2/static/sql-createview.html

Openerp:-  http://sajjadhossain.com/2013/06/30/openerp-7-creating-report-using-sql-query/

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: 8/19/14, 3:33 AM
Seen: 632 times
Last updated: 3/16/15, 8:10 AM