[IMP]:purchase:Improved SQL purchase report.
bzr revid: apa@tinyerp.com-20100405072903-6xfy9b27wuvs4139
This commit is contained in:
parent
6d4cc7afcc
commit
65050c80fc
|
@ -52,7 +52,7 @@ class report_purchase_order(osv.osv):
|
|||
'quantity': fields.float('# of Products', readonly=True),
|
||||
'price_total': fields.float('Total Price', readonly=True),
|
||||
'price_average': fields.float('Average Price', readonly=True),
|
||||
'count': fields.integer('# of Lines', readonly=True),
|
||||
'nbr': fields.integer('# of Lines', readonly=True),
|
||||
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'),
|
||||
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
|
||||
|
||||
|
@ -75,7 +75,7 @@ class report_purchase_order(osv.osv):
|
|||
l.product_id,
|
||||
t.categ_id as category_id,
|
||||
sum(l.product_qty*u.factor) as quantity,
|
||||
count(*),
|
||||
count(*) as nbr,
|
||||
sum(l.product_qty*l.price_unit) as price_total,
|
||||
(sum(l.product_qty*l.price_unit)/sum(l.product_qty*u.factor))::decimal(16,2) as price_average
|
||||
from purchase_order s
|
||||
|
|
|
@ -20,20 +20,19 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Purchase Orders Statistics">
|
||||
<field name="name"/>
|
||||
<field name="month"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="date"/>
|
||||
<field name="user_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="warehouse_id" invisible="1"/>
|
||||
<field name="category_id" invisible="1"/>
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="count"/>
|
||||
<field name="quantity"/>
|
||||
<field name="price_total"/>
|
||||
<field name="price_average"/>
|
||||
<field name="state"/>
|
||||
<field name="nbr" sum="# of Lines"/>
|
||||
<field name="price_average" avg="Average Price"/>
|
||||
<field name="price_total" sum="Total Price"/>
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="warehouse_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -64,13 +63,13 @@
|
|||
default="1"
|
||||
domain="[('state','<>','draft'),('state','<>','cancel')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="product_id"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-purchase"
|
||||
string="My Purchases"
|
||||
domain="[('user_id','=',uid)]"/>
|
||||
</field>
|
||||
<field name="partner_id"/>
|
||||
<field name="product_id"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
</group>
|
||||
<newline/>
|
||||
|
@ -80,7 +79,6 @@
|
|||
<filter string="Responsible" icon="terp-purchase" context="{'group_by':'user_id'}" default="1"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Product" icon="terp-purchase" context="{'group_by':'product_id'}"/>
|
||||
<filter string="Product Category" icon="terp-purchase" context="{'group_by':'category_id'}"/>
|
||||
<filter string="Partner" icon="terp-purchase" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="State" icon="terp-purchase" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
|
Loading…
Reference in New Issue