Corrections for hr_timesheet_invioce module:Report was showing division by zero error

bzr revid: jvo@tinyerp.com-20090227060345-3hk0p76ts0ipwt3g
This commit is contained in:
Jay (Open ERP)
2009-02-27 11:33:45 +05:30
parent 3f0f25404b
commit b6f431a26a
3 changed files with 25 additions and 6 deletions
+4 -4
View File
@@ -4,15 +4,15 @@
<menuitem id="hr.menu_hr_reporting" name="Reporting" parent="hr.menu_hr_root" sequence="40"/>
<report auto="False" id="report_user_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet" xsl="hr_timesheet/report/user_timesheet.xsl"/>
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee timesheet"/>
<wizard id="wizard_hr_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet" string="Employee Timesheet"/>
<menuitem id="next_id_48" name="Timesheet" parent="hr.menu_hr_reporting"/><menuitem action="wizard_hr_timesheet" id="menu_wizard_hr_timesheet" parent="next_id_48" type="wizard"/>
<wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print my timesheet"/>
<wizard id="wizard_hr_timesheet_my" menu="False" model="hr.employee" name="hr.analytical.timesheet.my" string="Print My Timesheet"/>
<menuitem action="wizard_hr_timesheet_my" id="menu_wizard_hr_timesheet_my" parent="hr_timesheet.next_id_48" type="wizard"/>
<report auto="False" id="report_users_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees timesheet" xsl="hr_timesheet/report/users_timesheet.xsl"/>
<report auto="False" id="report_users_timesheet" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet" xsl="hr_timesheet/report/users_timesheet.xsl"/>
<wizard id="wizard_hr_timesheet_users" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees timesheet"/>
<wizard id="wizard_hr_timesheet_users" menu="False" model="hr.employee" name="hr.analytical.timesheet_users" string="Employees Timesheet"/>
<menuitem action="wizard_hr_timesheet_users" id="menu_wizard_hr_timesheet_users" parent="hr_timesheet.next_id_48" type="wizard"/>
</data>
@@ -20,7 +20,7 @@
menu="False"
model="account.analytic.line"
name="account.analytic.profit"
string="Timesheet profit"
string="Timesheet Profit"
groups="account.group_account_manager"/>
<menuitem action="account_analytic_profit" id="print_account_analytic_profit" parent="hr.menu_hr_reporting" type="wizard"/>
@@ -22,6 +22,7 @@
import wizard
import datetime
import pooler
form='''<?xml version="1.0"?>
<form string="Choose">
@@ -34,8 +35,26 @@ form='''<?xml version="1.0"?>
class wizard_report(wizard.interface):
def _date_from(*a):
return datetime.datetime.today().strftime('%Y-%m-1')
def _date_to(*a):
return datetime.datetime.today().strftime('%Y-%m-%d')
def _check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
line_obj = pool.get('account.analytic.line')
product_obj = pool.get('product.product')
price_obj = pool.get('product.pricelist')
ids = line_obj.search(cr, uid, [
('date', '>=', data['form']['date_from']),
('date', '<=', data['form']['date_to']),
('journal_id', 'in', data['form']['journal_ids'][0][2]),
('user_id', 'in', data['form']['employee_ids'][0][2]),
])
if not ids:
raise wizard.except_wizard(_('Data Insufficient!'), _('No Records Found for Report!'))
return data['form']
fields={
'date_from':{
@@ -70,7 +89,7 @@ class wizard_report(wizard.interface):
'result':{'type':'form', 'arch':form, 'fields':fields, 'state':[('end', 'Cancel'), ('report', 'Print')]}
},
'report':{
'actions':[],
'actions':[_check],
'result':{'type':'print', 'report':'account.analytic.profit', 'state':'end'}
}
}