This question has been flagged
3 Replies
5461 Views

In my business there are many stages from raw prospect (Leads) to final sale (Opportunity=Won). We use severl reports that take the total number of leads/opportunities in one stage and divide it by the total number of leads/opportunities in another stage to produce a percentage. I would like to configure report filters or analysis measures to do this automatically. My question is, first is this possible in odoo currently or will it have to be developed in a module?

I know I can get a count in stages during a specific time frame. That provides my variables, but I'm not sure how I could group and divide the two too produce the percentage...

I don't expect anyone to provide the code, but a little advice or pointing me in the right direction would be great! Thanks in advance. :)

Avatar
Discard
Best Answer

My best guess would be creating a new SQL view that has those calculations built-in, then add a new menu item under the Reporting section.  You'd probably need to define things fairly explicitly in the SQL to get it to work cleanly and quickly, but I don't see why it wouldn't work.  See addons/crm/report/crm_lead_report.py as an example implementation of creating a new view, or addons/account/report/accout_invoice_report.py as an example of a large sub-query with calculations that run on the results.

I don't know the details on this approach but my guess would be to use a sub-query to count the number of leads in each stage, then in the main query, re-list all the values plus divide the two counts.  Once you have it broken down into an SQL view you can re-run grouping queries on it.  Need to know a bit about SQL to do it, but most of the work for this can be done in a tool like pgAdmin to test out queries.

Avatar
Discard
Author

Thanks for the answer and I think you are at least partially right. I found this ( https://doc.odoo.com/trunk/web_graph/# ) , which describes the abilities of the reporting system in detail. That information plus this ( https://doc.odoo.com/trunk/web/search_view/ ), which describes filters in detail made me realize that I was going to need a custom module. I am currently coding an inherited CRM report, setting variables that perform my calculations and using those computed variables as a measure selection in my report. Coupled with some custom filters I should be able to accomplish what I want to do. Going to try anyway. BTW, I'm giving you a vote for the effort, but can't accept this as a complete answer. Thanks again.

Well I don't know enough about what you're trying to do so it's a bit tough to come up with specific details. If you want to post some sample code as a reference it's a lot easier to come up with a detailed response.

Best Answer

You will need to create a new module to achieve the desired report as you want. We also provide a simple report that you can refer to in order to build your own.

Avatar
Discard
Best Answer

We must customize the code inorder to get reports other than default.
Either you can use the studio module for creating reports if you are using enterprise otherwise you can check odoo apps for community module
Example
https://apps.odoo.com/apps/modules/16.0/crm_dashboard/

Avatar
Discard