Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
4745 Widoki

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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/

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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'
            )""")

Awatar
Odrzuć

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

Powiązane posty Odpowiedzi Widoki Czynność
1
lis 24
1693
0
sie 24
1677
2
sie 24
245
0
sie 24
12
4
mar 24
3534