[IMP]:hr_timesheet_sheet:Improved SQL report.(Timesheet).

bzr revid: apa@tinyerp.com-20100428062743-cwkcunmyn2gjojdi
This commit is contained in:
apa-tiny
2010-04-28 11:57:43 +05:30
parent 33ee081b63
commit 2fddb283e5
3 changed files with 10 additions and 15 deletions
@@ -103,7 +103,7 @@
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_timesheet_line_search"/>
</record>
<menuitem action="action_timesheet_line_stat_all" id="menu_report_timesheet_line_all" parent="hr.menu_hr_reporting"/>
<!--menuitem action="action_timesheet_line_stat_all" id="menu_report_timesheet_line_all" parent="hr.menu_hr_reporting"/-->
<!-- Statistics report on timesheet by user -->
@@ -45,9 +45,8 @@ class timesheet_report(osv.osv):
('draft','Draft'),
('confirm','Confirmed'),
('done','Done')], 'State', readonly=True),
'total_att': fields.float('Total Timesheet',readonly=True),
'total_ts': fields.float('Total Attendance',readonly=True),
'total_diff': fields.float('Difference', readonly=True),
'quantity': fields.float('#Quantity',readonly=True),
'cost': fields.float('#Cost',readonly=True),
}
def init(self, cr):
@@ -64,9 +63,8 @@ class timesheet_report(osv.osv):
to_char(htss.date_current,'MM') as month,
to_char(htss.date_current, 'YYYY-MM-DD') as day,
count(*) as nbr,
sum(day.total_attendance) as total_att,
sum(day.total_timesheet) as total_ts,
sum(day.total_difference) as total_diff,
sum(aal.unit_amount) as quantity,
sum(aal.amount) as cost,
aal.account_id,
htss.user_id,
htss.company_id,
@@ -75,7 +73,6 @@ class timesheet_report(osv.osv):
from account_analytic_line as aal
left join hr_analytic_timesheet as hat ON (hat.line_id=aal.id)
left join hr_timesheet_sheet_sheet as htss ON (hat.line_id=htss.id)
left join hr_timesheet_sheet_sheet_day AS day ON (htss.id = day.sheet_id)
group by
to_char(htss.date_current,'YYYY'),
to_char(htss.date_current,'MM'),
@@ -7,10 +7,9 @@
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Timesheet" type="bar">
<field name="name" />
<field name="total_att" operator = "+"/>
<field name="total_ts" operator = "+"/>
<field name="user_id" group = "True"/>
<field name="user_id" />
<field name="quantity" operator = "+"/>
<field name="state" group = "True"/>
</graph>
</field>
</record>
@@ -25,9 +24,8 @@
<field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<field name="total_att" sum="Total Timesheet"/>
<field name="total_diff" sum="Total Attendance"/>
<field name="total_ts" sum="Difference"/>
<field name="quantity" sum="#Quantity"/>
<field name="cost" sum="#Cost"/>
<field name="state" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="company_id" invisible="1"/>