This is the documentation for older versions of Odoo (formerly OpenERP).

See the new Odoo user documentation.

See the new Odoo technical documentation.

Graph views

A graph is a new mode of view for all views of type form. If, for example, a sale order line must be visible as list or as graph, define it like this in the action that open this sale order line. Do not set the view mode as "tree,form,graph" or "form,graph" - it must be "graph,tree" to show the graph first or "tree,graph" to show the list first. (This view mode is extra to your "form,tree" view and should have a separate menu item):

<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>

view_type:

tree = (tree with shortcuts at the left), form = (switchable view form/list)

view_mode:

tree,graph : sequences of the views when switching

接下来,用户可以从一个视图转换到另一个视图。不像表单和列表视图一样,OpenERP不能自动按需创建graph视图,所以你必须自己定义graph视图:

<record model="ir.ui.view" id="view_order_line_graph">
   <field name="name">sale.order.line.graph</field>
   <field name="model">sale.order.line</field>
   <field name="type">graph</field>
   <field name="arch" type="xml">
         <graph string="Sales Order Lines">
              <field name="product_id" group="True"/>
              <field name="price_unit" operator="*"/>
        </graph>
    </field>
</record>

The graph view

graph类型的视图只是graph的字段列表。

Graph tag

graph的默认类型是圆形分格统计图表(pie chart),要将它转换成条形图(barchart),就需要将<graph string=”Sales Order Lines”> 转换成 <graph string=”Sales Order Lines” type=”bar”>,你也可以改变方向。

:例如 :

<graph string="Sales Order Lines" orientation="horizontal" type="bar">

Field tag

第一个字段是x轴,第二个是y轴,第三个是z轴,这个是可选择的三维图字段。你可以运用一些属性到每个field/axis。

  • 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

  • operator: the operator to apply is another field is grouped. By default it's '+'. Allowed values are:

    • +: addition

    • *: multiply

    • **: exponent

    • min: minimum of the list

    • max: maximum of the list

Defining real statistics on objects:
 

定义真正的对象数据统计:

  1. 定义一个统计对象,它是PostgreSQL视图

  2. 在这个对象上创建一个tree view和graph view

You can get en example in all modules of the form: report_.... Example: report_crm.