diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index affd81cce6d..aaf215c87f5 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -298,6 +298,14 @@ class hr_payslip(osv.osv): context=context).company_id.id, } + def _check_dates(self, cr, uid, ids, context=None): + for payslip in self.browse(cr, uid, ids, context=context): + if payslip.date_from > payslip.date_to: + return False + return True + + _constraints = [(_check_dates, "Payslip 'Date From' must be before 'Date To'.", ['date_from', 'date_to'])] + def copy(self, cr, uid, id, default=None, context=None): if not default: default = {} diff --git a/addons/hr_payroll/hr_payroll_report.xml b/addons/hr_payroll/hr_payroll_report.xml index a0027d70e0d..a1b3587313a 100644 --- a/addons/hr_payroll/hr_payroll_report.xml +++ b/addons/hr_payroll/hr_payroll_report.xml @@ -6,7 +6,7 @@ auto="False" id="payslip_report" model="hr.payslip" - name="test.pdf" + name="payslip" rml="hr_payroll/report/report_payslip.rml" string="Employee PaySlip" /> diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index 98ec4be407b..5f2e977f116 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -262,7 +262,7 @@ - + diff --git a/addons/hr_payroll/report/report_payslip.py b/addons/hr_payroll/report/report_payslip.py index 0fc37b44ac7..e2ef7dab974 100644 --- a/addons/hr_payroll/report/report_payslip.py +++ b/addons/hr_payroll/report/report_payslip.py @@ -44,6 +44,6 @@ class payslip_report(report_sxw.rml_parse): res = payslip_line.browse(self.cr, self.uid, ids) return res -report_sxw.report_sxw('report.test.pdf', 'hr.payslip', 'hr_payroll/report/report_payslip.rml', parser=payslip_report) +report_sxw.report_sxw('report.payslip', 'hr.payslip', 'hr_payroll/report/report_payslip.rml', parser=payslip_report) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py index 21e74da992c..a022cac05b1 100644 --- a/addons/hr_payroll_account/hr_payroll_account.py +++ b/addons/hr_payroll_account/hr_payroll_account.py @@ -40,6 +40,17 @@ class hr_payslip(osv.osv): 'move_id': fields.many2one('account.move', 'Accounting Entry', readonly=True), } + def _get_default_journal(self, cr, uid, context=None): + model_data = self.pool.get('ir.model.data') + res = model_data.search(cr, uid, [('name', '=', 'expenses_journal')]) + if res: + return model_data.browse(cr, uid, res[0]).res_id + return False + + _defaults = { + 'journal_id': _get_default_journal, + } + def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {}