Are you interested in getting the sales details of your firm from anywhere you go . If you want to check out the trend of your business for a month or in the current year, if you need the sales details of particular product or category at the moment in a precise way, OpenERP provides these functionalities with analysis report and graph views.
Analysis reports are used for creating dynamic reports in OpenERP. The advantages of analysis reports are:
We can select the report based on the search view filters. For example Sales Analysis report can be generated for a Salesperson, Partner, Product, Shop, Quotations etc.
Values can be directly copy pasted to an excel or csv file, where proper alignment will be got automatically.
Reports can be generated in the form of graphs.
For creating the Sales Analysis report, there should be a model defined for it. OpenERP objects can be created from PostgreSQL views. The technique is as follows :
Declare your _columns dictionary. All fields must have the flag readonly=True.
Specify the parameter _auto=False to the OpenERP object, so no table corresponding to the _columns dictionary is created automatically.
Add a method init(self, cr) that creates a PostgreSQL View matching the fields declared in _columns.
For the model ‘sale.report’ data is taken from a view defined in the init method of the model. The value for each field is calculated dynamically, that is at the time we click on the menuitem for the Sales Analysis report in Reporting tab. The aliases in the select query of the view creation are the field names of the model sale_report. For example in select query you can find
l.uom_id as product_uom
where product_uom is column in the model ‘sale_report’.
Next step is to define the tree, graph and search view for the model.
1. Tree view
In the tree view, there is an attribute in the <tree> tag that is create=”false”. This is used for hiding the create button in the tree view.
2. Graph view
The default type of the graph is a pie chart – to change it to a barchart change, type=”bar” in the graph tag.
The first field is the X axis. The second one is the Y axis and the optional third one is the Z axis for 3 dimensional graphs. You can apply a few attributes to each field/axis:
1. group: if set to true, the client will group all item of the same value for this field. For each other field, it will apply an operator.
2. operator: the operator to apply is another field is grouped. By default it’s ‘+’.
Allowed values are:
a. +: addition
b. *: multiply
c. **: exponent
d. min: minimum of the list
e. max: maximum of the list
3. Search View
Now define an action for the views
Add necessary menuitems so that the Sales Analysis report should be displayed under the Reporting tab.
In the web client goto Reporting -> Sales -> Sales Analysis and you can find the tree view as
and
Both of these can be viewed based on the filters defined in the search view. For example adding the filters product and shop the views will be like the following
and
You can also view/download the details as csv in the graph view by using Graph Options button.
and
Anonymous: Sometimes I loose my patience so fast. Just updating the db - its working fine.".
Leave a Reply