Added Turnover Per Product dashboard view for board_service

bzr revid: jvo@tinyerp.com-20090325122407-vdwkhaz7mu1eave4
This commit is contained in:
Jay (Open ERP)
2009-03-25 17:54:07 +05:30
parent cc01f4b3e4
commit f06c0a7f01
2 changed files with 58 additions and 0 deletions
+21
View File
@@ -131,6 +131,27 @@ class report_turnover_per_month(osv.osv):
""")
report_turnover_per_month()
class report_turnover_per_product(osv.osv):
_name = "report.turnover.per.product"
_description = "Turnover Per Product"
_auto = False
_rec_name = 'product_id'
_columns = {
'product_id': fields.many2one('product.product','Product', readonly=True),
'turnover': fields.float('Total Turnover', readonly=True),
}
def init(self, cr):
cr.execute("""
create or replace view report_turnover_per_product as (
select min(am.id) as id, sum(credit) as turnover,am.product_id as product_id
from account_move_line am
group by am.product_id
)
""")
report_turnover_per_product()
class report_sale_order_created(osv.osv):
_name = "report.sale.order.created"
_description = "Report of Creaed Sale Order"
+37
View File
@@ -171,6 +171,8 @@
<field name="domain">[('state','&lt;&gt;','done')]</field>
</record>
<!-- Turnover Per Month -->
<record model="ir.ui.view" id="view_turnover_month_tree">
<field name="name">report.turnover.per.month.tree</field>
<field name="model">report.turnover.per.month</field>
@@ -203,6 +205,41 @@
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_turnover_month_tree"/>
</record>
<!-- Turnover Per Product -->
<record model="ir.ui.view" id="view_turnover_product_tree">
<field name="name">report.turnover.per.product.tree</field>
<field name="model">report.turnover.per.product</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Turnover Per Product">
<field name="product_id" select="1"/>
<field name="turnover" select="2"/>
</tree>
</field>
</record>
<record id="view_turnover_product_graph" model="ir.ui.view">
<field name="name">report.turnover.per.product.graph</field>
<field name="model">report.turnover.per.product</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Turnover Per Product" type="bar">
<field name="product_id" />
<field name="turnover" />
</graph>
</field>
</record>
<record model="ir.actions.act_window" id="action_turnover_product_tree">
<field name="type">ir.actions.act_window</field>
<field name="name">Turnover Per Product</field>
<field name="res_model">report.turnover.per.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_turnover_product_tree"/>
</record>
<!-- Created Sale orders for random activities dashboard -->