0
votes

In Odoo Opportunity Report I would like to add field customer from res.partner.

I created addon (which installed, and does other things besides, so I am sure that addon works) in which I have inherited from https://github.com/odoo/odoo/blob/10.0/addons/crm/report/crm_opportunity_report.py .

And added a field

customer = fields.Boolean('Customer', related='partner_id.customer', readonly=True)

But field Customer doesn't appear in report when I click '+' in Reports->Pipeline.

What did I miss?

1
How did you inherit crm.opportunity.report exactly? Can you provide the code? My first guess: you forgot to extend the postgres database view, odoo is using for those reporting feature. (in your example in the init()) - CZoellner
did you check that the customer field exits in your model, check that in setting?? related field can be used in reports - Charif DZ
@CZoellner thank You. You are right, I have not added (intentionally :)) that field to the view, I was hoping for some magic (that it will work somehow without modifying the view) :D. - Developer Marius Žilėnas
@Cherif yes, there is a boolean field customer in model res_partner (and in table res_partner). :) - Developer Marius Žilėnas

1 Answers

1
votes

It is not enough to define a field. Odoo reporting is working on database views. So by adding a new field, you have to change the view, too. Normally or in newer versions Odoo has good extendable view definitions by using the init(). In your example it's the old "bad to extend" view definition, so you have to override the whole init.