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. :)
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.
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
|Asked: 9/8/14, 10:57 AM|
|Seen: 1700 times|
|Last updated: 3/16/15, 8:10 AM|