[IMP] Timesheet

bzr revid: nel@tinyerp.com-20100607104921-o0n8qctydiqegyvf
This commit is contained in:
nel@tinyerp.com 2010-06-07 12:49:21 +02:00
parent 1d99d0277f
commit 3621f20374
2 changed files with 51 additions and 33 deletions

View File

@ -39,6 +39,9 @@ class timesheet_report(osv.osv):
'to_invoice': fields.many2one('hr_timesheet_invoice.factor', 'Type of Invoicing',readonly=True),
'account_id': fields.many2one('account.analytic.account', 'Analytic Account',readonly=True),
'nbr': fields.integer('#Nbr',readonly=True),
'total_diff': fields.float('#Total Diff',readonly=True),
'total_timesheet': fields.float('#Total Timesheet',readonly=True),
'total_attendance': fields.float('#Total Attendance',readonly=True),
'company_id': fields.many2one('res.company', 'Company',readonly=True),
'department_id':fields.many2one('hr.department','Department',readonly=True),
'date_from': fields.date('Date from',readonly=True,),
@ -67,10 +70,25 @@ 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(aal.unit_amount) as quantity,
sum(aal.amount) as cost,
aal.unit_amount as quantity,
aal.amount as cost,
aal.account_id,
aal.product_id,
(SELECT sum(day.total_difference)
FROM hr_timesheet_sheet_sheet AS sheet
LEFT JOIN hr_timesheet_sheet_sheet_day AS day
ON (sheet.id = day.sheet_id
AND day.name = sheet.date_current) where sheet.id=htss.id) as total_diff,
(SELECT sum(day.total_timesheet)
FROM hr_timesheet_sheet_sheet AS sheet
LEFT JOIN hr_timesheet_sheet_sheet_day AS day
ON (sheet.id = day.sheet_id
AND day.name = sheet.date_current) where sheet.id=htss.id) as total_timesheet,
(SELECT sum(day.total_attendance)
FROM hr_timesheet_sheet_sheet AS sheet
LEFT JOIN hr_timesheet_sheet_sheet_day AS day
ON (sheet.id = day.sheet_id
AND day.name = sheet.date_current) where sheet.id=htss.id) as total_attendance,
aal.to_invoice,
aal.general_account_id,
htss.user_id,
@ -87,6 +105,8 @@ class timesheet_report(osv.osv):
aal.account_id,
htss.date_from,
htss.date_to,
aal.unit_amount,
aal.amount,
htss.date_current,
aal.to_invoice,
aal.product_id,
@ -94,8 +114,9 @@ class timesheet_report(osv.osv):
htss.name,
htss.company_id,
htss.state,
htss.id,
htss.department_id,
htss.user_id
)
""")
timesheet_report()
timesheet_report()

View File

@ -24,8 +24,6 @@
<field name="user_id" invisible="1"/>
<field name="date_from" invisible="1"/>
<field name="date_to" invisible="1"/>
<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"/>
@ -36,6 +34,11 @@
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="quantity" sum="#Quantity"/>
<field name="cost" sum="#Cost"/>
<field name="total_diff" sum="#Total Diff"/>
<field name="total_timesheet" sum="#Total Timesheet"/>
<field name="total_attendance" sum="#Total Attendance"/>
</tree>
</field>
</record>
@ -65,52 +68,46 @@
<filter icon="terp-camera_test"
string="Confirmed"
domain="[('state','=','confirm')]"/>
<filter icon="terp-dialog-close"
string="Done"
domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="product_id"/>
<field name="user_id" widget="selection">
<filter icon="terp-personal-"
string="Non Assigned timesheets to users"
help="Non Assigned timesheets to users"
domain="[('user_id','=',False)]"/>
</field>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<field name="account_id"/>
<field name="user_id" />
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
<group expand="1" string="Group By...">
<filter string="User" name="User_id" icon="terp-personal" context="{'group_by':'user_id'}"/>
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<separator orientation="vertical"/>
<filter string="Type of Invoicing" icon="terp-stock_symbol-selection" context="{'group_by':'to_invoice'}"/>
<separator orientation="vertical"/>
<filter string="Analytic Account" icon="terp-folder-green" context="{'group_by':'account_id'}"/>
<filter string="General Account" icon="terp-folder-orange" context="{'group_by':'general_account_id'}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-go-month" context="{'group_by':'day'}"/>
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." groups="base.group_extended">
<filter icon="terp-document-new"
string="New"
domain="[('state','=','new')]"/>
<separator orientation="vertical"/>
<field name="date_from"/>
<separator orientation="vertical"/>
<field name="account_id"/>
<field name="department_id" widget="selection"/>
<newline/>
<filter icon="terp-dialog-close"
string="Done"
domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="date_to"/>
<separator orientation="vertical"/>
<field name="general_account_id"/>
<field name="to_invoice" widget="selection"/>
<separator orientation="vertical"/>
<field name="product_id"/>
<separator orientation="vertical"/>
<field name="department_id" widget="selection"/>
<separator orientation="vertical"/>
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
<newline/>
<field name="date_to"/>
<field name="date_from"/>
</group>
</search>
</field>
@ -121,7 +118,7 @@
<field name="res_model">timesheet.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="context">{'search_default_month':1,'search_default_User':1,'search_default_user_id':uid,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_month':1,'search_default_User_id':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="search_view_id" ref="view_timesheet_report_search"/>
</record>
<menuitem action="action_timesheet_report_stat_all" id="menu_timesheet_report_all" parent="hr.menu_hr_reporting"/>