[IMP]:hr_expense:Add #Accounts in SQL virw report..(Expense).

bzr revid: apa@tinyerp.com-20100429102430-71xa5n0e2x0o7mx6
This commit is contained in:
apa-tiny 2010-04-29 15:54:30 +05:30
parent c7b027483e
commit 9dd2f2d39a
2 changed files with 3 additions and 0 deletions

View File

@ -51,6 +51,7 @@ class hr_expense_report(osv.osv):
'price_average':fields.float('Average Price', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
'no_of_products':fields.integer('# of Products', readonly=True),
'no_of_account':fields.integer('# of Accounts', readonly=True),
'state': fields.selection([
('draft', 'Draft'),
('confirm', 'Waiting confirmation'),
@ -87,6 +88,7 @@ class hr_expense_report(osv.osv):
(sum(l.unit_quantity*l.unit_amount)/sum(l.unit_quantity * u.factor))::decimal(16,2) as price_average,
count(*) as nbr,
(select unit_quantity from hr_expense_line where id=l.id and product_id is not null) as no_of_products,
(select count(analytic_account) from hr_expense_line where id=l.id and analytic_account is not null) as no_of_account,
s.state
from hr_expense_line l
left join hr_expense_expense s on (s.id=l.expense_id)

View File

@ -23,6 +23,7 @@
<field name="product_qty" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="no_of_products" sum="# of Products"/>
<field name="no_of_account" sum="# of Accounts"/>
<field name="price_average" avg="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="state" invisible="1"/>