diff --git a/addons/hr_attendance/test/hr_attendance_report.yml b/addons/hr_attendance/test/hr_attendance_report.yml index d26f6ddb9bc..bb3dc8ea037 100644 --- a/addons/hr_attendance/test/hr_attendance_report.yml +++ b/addons/hr_attendance/test/hr_attendance_report.yml @@ -1,19 +1,21 @@ - - In order to test the PDF reports defined on HR Attendance, we will print a report of HR Attendance By Month + Print the HR Attendance Report By Month through the wizard - !python {model: hr.employee}: | import netsvc, tools, os, time - data_dict = {'model': 'hr.employee', 'form': {'month': time.gmtime()[1], 'year': time.gmtime()[0]}} - (data, format) = netsvc.LocalService('report.hr.attendance.bymonth').create(cr, uid, [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-by_month_report.'+format), 'wb+').write(data) + ctx={} + ctx.update({'model': 'hr.employee','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) + data_dict = {'month': time.gmtime()[1], 'year': time.gmtime()[0]} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_attendance_month',wiz_data=data_dict, context=ctx, our_module='hr_attendance') - - In order to test the PDF reports defined on HR Attendance, we will print a report of HR Attendance Error -- + Print HR Attendance Error Report through the wizard +- !python {model: hr.employee}: | import netsvc, tools, os, time - data_dict = {'model': 'hr.employee', 'form': {'init_date': time.strftime('%Y-01-01'), 'end_date':time.strftime('%Y-%m-%d'), 'emp_ids': [ref('hr.employee1')], 'max_delay': 120}} - (data, format) = netsvc.LocalService('report.hr.attendance.error').create(cr, uid, [ref('hr.employee1')], data_dict, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_attendance-error_report.'+format), 'wb+').write(data) + ctx={} + ctx.update({'model': 'hr.employee','active_ids': [ref('hr.employee1')]}) + data_dict = {'init_date': time.strftime('%Y-01-01'), 'end_date':time.strftime('%Y-%m-%d'), 'max_delay': 120 } + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_attendance_error',wiz_data=data_dict, context=ctx, our_module='hr_attendance') diff --git a/addons/hr_holidays/test/hr_holidays_report.yml b/addons/hr_holidays/test/hr_holidays_report.yml index 9faf7358b53..bd16f5da147 100644 --- a/addons/hr_holidays/test/hr_holidays_report.yml +++ b/addons/hr_holidays/test/hr_holidays_report.yml @@ -1,14 +1,22 @@ - - In order to test the PDF reports defined on a HR Holidays, we will print HR Holidays + Print the HR Holidays(Summary Department) Report through the wizard - !python {model: hr.holidays}: | import netsvc, tools, os, time - data_dict = {'model': 'ir.ui.menu', 'form': {'date_from': time.strftime('%Y-%m-01'), 'depts' : [ref('hr.dep_sales')],'holiday_type' : 'Validated' }} - (data, format) = netsvc.LocalService('report.holidays.summary').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_holidays-dept_summary_report.'+format), 'wb+').write(data) - - data_dict = {'model': 'hr.employee', 'form': {'date_from': time.strftime('%Y-%m-01'), 'depts' : [ref('hr.dep_sales')],'holiday_type' : 'Validated','emp':[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')] }} - (data, format) = netsvc.LocalService('report.holidays.summary').create(cr, uid, [], data_dict, {'active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_holidays-employee_summary_report.'+format), 'wb+').write(data) \ No newline at end of file + ctx={} + ctx.update({'model': 'hr.department','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) + data_dict = {'date_from': time.strftime('%Y-%m-01'), 'depts' : [(6,0,[ref('hr.dep_sales')])],'holiday_type' : 'Validated'} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_holidays_summary_dept',wiz_data=data_dict, context=ctx, our_module='hr_holidays') + +- + Print the HR Holidays(Summary Employee) Report through the wizard +- + !python {model: hr.holidays}: | + import netsvc, tools, os, time + ctx={} + ctx.update({'model': 'hr.employee','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')]}) + data_dict = {'date_from': time.strftime('%Y-%m-01'), 'emp' : [(6,0,[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')])],'holiday_type' : 'Validated'} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_holidays_summary_employee',wiz_data=data_dict, context=ctx, our_module='hr_holidays') + diff --git a/addons/hr_payroll/__openerp__.py b/addons/hr_payroll/__openerp__.py index 7d66f25b445..79d692a5c30 100644 --- a/addons/hr_payroll/__openerp__.py +++ b/addons/hr_payroll/__openerp__.py @@ -57,7 +57,7 @@ # 'test/payslip.yml', # 'test/payment_advice.yml', # 'test/payroll_register.yml', -# 'test/hr_payroll_report.yml', + 'test/hr_payroll_report.yml', ], 'demo_xml': [ 'hr_payroll_demo.xml' diff --git a/addons/hr_payroll/test/hr_payroll_report.yml b/addons/hr_payroll/test/hr_payroll_report.yml index 35020d30ceb..6e30aba437e 100644 --- a/addons/hr_payroll/test/hr_payroll_report.yml +++ b/addons/hr_payroll/test/hr_payroll_report.yml @@ -1,6 +1,6 @@ - In order to test the PDF reports defined on HR Payroll, we will print Employees' Salary Structure -- +- !python {model: hr.employee}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.salary.structure').create(cr, uid, [ref('hr_payroll.hr_employee_bonamy0')], {}, {}) @@ -9,7 +9,7 @@ - Print HR Payslip -- +- !python {model: hr.payslip}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.payslip.pdf').create(cr, uid, [ref('hr_payroll.hr_payslip_salaryslipofbonamyforjune0')], {}, {}) @@ -17,23 +17,25 @@ file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payslip_report.'+format), 'wb+').write(data) - - Print HR Employee Salary Details + Print Employee Salary Statement through wizard - !python {model: hr.payslip}: | import netsvc, tools, os, time - emp_ids = [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')] - data_dict = {'model': 'ir.ui.menu', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'employee_ids': emp_ids, 'ids':emp_ids }} - (data, format) = netsvc.LocalService('report.employees.salary').create(cr, uid, [], data_dict, {'active_ids': emp_ids}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_salary_detail_report.'+format), 'wb+').write(data) -- - Print HR Employee Salary Details Annual basis -- - !python {model: hr.payslip}: | - import netsvc, tools, os, time - emp_ids = [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')] - data_dict = {'model': 'hr.payslip', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'salary_on': 'current_month', 'employee_ids': emp_ids, 'ids':emp_ids}} - (data, format) = netsvc.LocalService('report.year.salary').create(cr, uid, [], data_dict,{'active_ids': emp_ids} ) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_yearly_salary_detail_report.'+format), 'wb+').write(data) + ctx={} + ctx.update({'model': 'hr.employee','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]}) + data_dict = {'employee_ids': [(6,0,[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')])], 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d')} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_payroll_employees_detail',wiz_data=data_dict, context=ctx, our_module='hr_payroll') + +- + Print Salary Register through wizard +- + !python {model: hr.payslip}: | + import netsvc, tools, os, time + ctx={} + ctx.update({'model': 'hr.payslip','active_ids': [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]}) + data_dict = {'employee_ids': [(6,0,[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')])], 'date_from': time.strftime('%Y-01-01'), 'date_to': time.strftime('%Y-%m-%d')} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_payroll_year_salary',wiz_data=data_dict, context=ctx, our_module='hr_payroll') + diff --git a/addons/hr_timesheet/test/hr_timesheet_report.yml b/addons/hr_timesheet/test/hr_timesheet_report.yml index b1cd445a35d..5005c5d724d 100644 --- a/addons/hr_timesheet/test/hr_timesheet_report.yml +++ b/addons/hr_timesheet/test/hr_timesheet_report.yml @@ -1,23 +1,21 @@ - - In order to test the PDF reports defined on Employee, we will print Timesheet of a User + Print the HR Timesheet By Employee report through the wizard - !python {model: hr.employee}: | import netsvc, tools, os, time - month = time.gmtime()[1] - year = time.gmtime()[0] - data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'employee_id' : ref('hr.employee1') }} - (data, format) = netsvc.LocalService('report.hr.analytical.timesheet').create(cr, uid, [], data_dict, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet-user_report.'+format), 'wb+').write(data) + ctx={} + ctx.update({'model': 'hr.employee','active_ids': []}) + data_dict = {'month': time.gmtime()[1], 'year': time.gmtime()[0], 'employee_id' : ref('hr.employee1')} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_timesheet_my',wiz_data=data_dict, context=ctx, our_module='hr_timesheet') - - In order to test the PDF reports defined on Employee, we will print Timesheet of Users + Print the HR Timesheet By Employee report through the wizard - !python {model: hr.employee}: | import netsvc, tools, os, time - month = time.gmtime()[1] - year = time.gmtime()[0] - data_dict = {'model': 'ir.ui.menu', 'form': {'month': month, 'year' : year, 'employee_ids' : [ref('hr.employee1')] }} - (data, format) = netsvc.LocalService('report.hr.analytical.timesheet_users').create(cr, uid, [], data_dict, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet-users_report.'+format), 'wb+').write(data) + ctx={} + ctx.update({'model': 'hr.employee','active_ids': []}) + data_dict = {'month': time.gmtime()[1], 'year': time.gmtime()[0], 'employee_ids' : [(6,0,[ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3')])]} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_timesheet_users',wiz_data=data_dict, context=ctx, our_module='hr_timesheet') \ No newline at end of file diff --git a/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml index 32f22e7eb4b..886bb89b5b7 100644 --- a/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml +++ b/addons/hr_timesheet_invoice/test/hr_timesheet_invoice_report.yml @@ -7,14 +7,14 @@ (data, format) = netsvc.LocalService('report.account.analytic.profit').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-account_analytic_profit_report.'+format), 'wb+').write(data) - - - In order to test the PDF reports defined on HR Cost Ledger, we will print report of HR Cost Ledger + Print the HR Cost Ledger report through the wizard - !python {model: account.analytic.account}: | import netsvc, tools, os, time + ctx={} acc_ids = [ref('account.analytic_absences'),ref('account.analytic_internal'),ref('account.analytic_sednacom'),ref('account.analytic_thymbra'),ref('account.analytic_partners_camp_to_camp')] - data_dict = {'model': 'ir.ui.menu', 'form': {'date1': time.strftime('%Y-01-01'), 'date2': time.strftime('%Y-%m-%d')}} - (data, format) = netsvc.LocalService('report.hr.timesheet.invoice.account.analytic.account.cost_ledger').create(cr, uid, acc_ids, data_dict, {'active_ids': acc_ids}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'hr_timesheet_invoice-cost_ledger_report.'+format), 'wb+').write(data) + ctx.update({'model': 'ir.ui.menu','active_ids': acc_ids}) + data_dict = {'date1': time.strftime('%Y-01-01'), 'date2': time.strftime('%Y-%m-%d')} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_hr_timesheet_invoice_cost_ledger',wiz_data=data_dict, context=ctx, our_module='hr_timesheet_invoice') diff --git a/addons/point_of_sale/test/point_of_sale_report.yml b/addons/point_of_sale/test/point_of_sale_report.yml index d058c8fd691..3bccb50307d 100644 --- a/addons/point_of_sale/test/point_of_sale_report.yml +++ b/addons/point_of_sale/test/point_of_sale_report.yml @@ -51,22 +51,29 @@ (data, format) = netsvc.LocalService('report.pos.receipt.without.remboursment').create(cr, uid, [ref('point_of_sale.order_pos1'), ref('point_of_sale.order_pos2')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-receipt without reimbursement report'+format), 'wb+').write(data) + - - In order to test the PDF reports defined on a Point Of Sale, we will print a POS Payment Report + Print the POS Payment Report through the wizard - !python {model: ir.ui.menu}: | import netsvc, tools, os, time - (data, format) = netsvc.LocalService('report.pos.payment.report.date').create(cr, uid, [1], {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'), 'user_id': [ref('base.user_root')] }}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos sales lines report'+format), 'wb+').write(data) + ctx={} + ctx.update({'model': 'ir.ui.menu','active_ids': []}) + data_dict = {'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d'), 'user_id': [(6,0,[ref('base.user_root')])] } + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_report_pos_payment_repport_date',wiz_data=data_dict, context=ctx, our_module='point_of_sale') + - - In order to test the PDF reports defined on a Point Of Sale, we will print a POS Details Report + Print the POS Details Report through the wizard - !python {model: ir.ui.menu}: | import netsvc, tools, os, time - (data, format) = netsvc.LocalService('report.pos.details').create(cr, uid, [], {'model':'ir.ui.menu', 'form':{'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d') }}, {}) - if tools.config['test_report_directory']: - file(os.path.join(tools.config['test_report_directory'], 'point_of_sale- pos details report'+format), 'wb+').write(data) + ctx={} + ctx.update({'model': 'ir.ui.menu','active_ids': []}) + data_dict = {'date_start': time.strftime('%Y-%m-%d'), 'date_end': time.strftime('%Y-%m-%d')} + from tools import test_reports + test_reports.try_report_action(cr, uid, 'action_report_pos_details',wiz_data=data_dict, context=ctx, our_module='point_of_sale') + - I create a cash journal. -