OpenErp(Odoo) How to add custom analysis on reporting Tab - odoo

I need to make summery of raw materials used, the qualty of products ,final products status . . . for each manufactureing process and provide this information on the reporing tab like sales anlysis and purchase analysis . . . How can I do this? and insights about my requirment?

Create a module for your custom analysis report. I will explain how the Sales Analysis report is created. Using that you could create your own analysis report.
Steps
Create a module for your report in the addons folder. You can use the following link for details about creating a module How to create an ODOO module
Create a python file in the module and import it in the __init__.py file. In that file create a model based on a PostgreSQL view. Add a method init(self, cr) that creates a PostgreSQL View matching the fields declared in _columns. You can check this in the file sale_report.py in report folder of sale module. Create the fields you needed in the _columns and write the query in the init method for getting values to these fields.
Specify the parameter _auto=False to the OpenERP object, so no table corresponding to the _columns dictionary is created automatically.
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 uom_id as product_uom where product_uom is column in the model sale_report.
Define the views. Create an XML file in the report folder of the module. You can use the sale_report_view.xml file in the sale module as reference. Create an XML view for the model, including tree view, search view and graph 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. Create an action and a menuitem for the view as in the sales analysis report.
Restart the server and upgrade the module.
Compare your report with sales analysis reportto solve any issues.

Related

How to order rows when custom model is made from GUI in Odoo v 10?

I have made a custom model using GUI. This model contains a field named sequence.
I want to order my rows by this field.
This same this has been done for res.company model and i want the same.
So, for companies
_order = 'sequence, name' is written in model.
and widget='handle' is used in tree view that orders various companies just by drag and drop.
So, i added this widget attribute in my tree view, but i don't know where to use _order='sequence'(the field I created in my model) because i don't have code for that model.
Is there a way that i can do i from GUI itself or I need to create that model from code??

concept of create method odoo8

I'm new at using odoo, so i faced an override of create method but still don't quite understand the concept.
This is the create method I used :
#api.model
def create(self, vals):
vals['task_idd'] = self.env['crane.task'].create({'equipment_id': vals['equipment_id'], 'type': vals['type']}).id
vals['task_ids'] = [(4, vals['task_idd'])]
return super(crane_workorder, self).create(vals)
this code works perfectly
i had a one2many relation that has been converted into one2one(logically), so i override the create method till i can create two records from two different classes...
PS1: equipment_id & type are required fields, but i don't understand how does it work ...
If what you mean is how does the list containing a single tuple [(4, vals['task_idd'])] give the desired result here is my understanding.
When Odoo is either creating or writing to a record which is a relation field Odoo uses a command syntax which is the structure you used in your code. Basically when writing or creating a related field from the perspective of any particular record Odoo tries to take away the ambiguity by creating a specific series of commands to use in these circumstances.
For instance if you need to write to a One2many field how is Odoo supposed to know if your are adding a new record to the list of many other records or are you saying that the list of related records is this new record you have referenced in your code.
So imagine you have a tree with a One2many relation with its Apples. If you were writing to a database recording another apple for the tree are you saying that this apple is to be added to the list of existing apples or is it replacing the existing list and should be considered the only apple that belongs to the tree.
So Odoo uses this tuple structure and has a process for parsing the tuple and determining how to handle its values and what to write to the database.
Here is a screen shot of the documentation Odoo provides on the matter. Here is the link to the page

How to create just a view in odoo9 that does not save data in a model?

I am working in odoo9. Now I needed a view that permits the user to select partner and get his sale history.
Now I created a model "sale.history" but it saves the selected data as a record in db. I really don't need this.
How can I create a view for this.
Please also see this image.
You have two options for such views/reports.
Use TransientModel instead of Model for the model inheritance. Transient model records in database will be deleted by a frequently running cron job. The email message PopUp/Wizard is a nice example for that.
Write your own report (database view) for sales order. Actually there already is one report for that: Reporting/Sales/Sales Analysis. The model for that report is sale.report if you want to know, how it's done.
Aside from using a TransientModel (old api) or AbstractModel (new api)...you can simply set the store property of field to false, that way your field will never be persisted to the database, it will simply be a 'view field'.
class sale_history(model.Model):
_name='sale.history'
partner = fields.Many2one('res.partner', store=False)
The partner field will never get saved to the database
You can use store=False on the field in the model (as danidee suggested).
You can also overwrite the create method on the model.
Question - what is the purpose of the "sale.history" model? If it does not store any data at all then you may be better off creating a new view against "res.partner" rather than creating a new model.

How to add an "Attribute" using Schema Workbench?

For educational reasons I would like to reproduce the following example schema from "Mondrian in Action":
But I cannot find a button for "Add Attribute"!?
I am only offered buttons for:
add cube
add dimension
add dimension usage
add hierarchy
add named set
add user defined function
add calculated member
add measure
add level
add property
add calculated member property
add virtual cube
add virtual cube dimension
add virtual cube measure
add role
Why is "add attribute" missing? Or ... what is it that I am missing here?
"attribute" has been added to Mondrian schema at version 4 while the Schema Workbench is officially no longer maintained and stuck at Mondrian schema version 3.x.
This should be the documentation for Mondrian 4:
http://mondrian.pentaho.com/head/documentation/schema.php
And this "seems" to be an older version - maybe 3.x:
http://mondrian.pentaho.com/documentation/schema.php

How to use SubReport in XtraReport?

I have a main Report which consist of (Detail Report)
Transaction #
Amount Due
PaymentType
Money Tendered
and I have another report which consist of items ordered (Items Report)
Transaction #
ItemName
Quantity
Amount Due
My question is how to combine the Items Report to the Detail Report
My Desired format is
Transaction # AmountDue PaymentType MoneyTendered
[Detail Report]==> Link through ID
Have a look here.
Creating a master-detail report with the use of subreports requires the following actions.
First, it is necessary to create two report classes (master and detail) and bind to data each of them. Note that the datasources of both reports should contain a data column with the same key, which can be passed from a master report to a detail report.
For the detail report, it is necessary to create a public parameter to be initialized outside the detail report. This parameter should be used to filter a datasource bound to the detail report against the column that contains a key.
Then, the detail report should be embedded into a master report via the XRSubreport control. In addition, it is required to handle its XRControl.BeforePrint event, and pass a key value from the master to the detail report.
Preview, print, export or publish a report on the Web at runtime.
If you want to use your own DataSet have a look here.