diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index b11f4202b73..70bac2a497c 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -255,19 +255,15 @@ class hr_payslip(osv.osv): 'date_from': fields.date('Date From', readonly=True, states={'draft': [('readonly', False)]}, required=True), 'date_to': fields.date('Date To', readonly=True, states={'draft': [('readonly', False)]}, required=True), 'state': fields.selection([ - ('draft', 'Waiting for Verification'), - ('hr_check', 'Waiting for HR Verification'), - ('accont_check', 'Waiting for Account Verification'), - ('confirm', 'Confirm Sheet'), - ('done', 'Paid Salary'), - ('cancel', 'Reject'), + ('draft', 'Draft'), + ('verify', 'Waiting'), + ('done', 'Done'), + ('cancel', 'Rejected'), ], 'State', select=True, readonly=True, - help=' * When the payslip is created the state is \'Waiting for verification\'.\ - \n* It is varified by the user and payslip is sent for HR varification, the state is \'Waiting for HR Verification\'. \ - \n* If HR varify the payslip, it is sent for account verification, the state is \'Waiting for Account Verification\'. \ - \n* It is confirmed by the accountant and the state set to \'Confirm Sheet\'.\ - \n* If the salary is paid then state is set to \'Paid Salary\'.\ - \n* The \'Reject\' state is used when user cancel payslip.'), + help='* When the payslip is created the state is \'Draft\'.\ + \n* If the payslip is under verification, the state is \'Waiting\'. \ + \n* If the payslip is confirmed then state is set to \'Done\'.\ + \n* When user cancel payslip the state is \'Rejected\'.'), # 'line_ids': fields.one2many('hr.payslip.line', 'slip_id', 'Payslip Line', required=False, readonly=True, states={'draft': [('readonly', False)]}), 'line_ids': one2many_mod2('hr.payslip.line', 'slip_id', 'Payslip Lines', readonly=True, states={'draft':[('readonly',False)]}), 'company_id': fields.many2one('res.company', 'Company', required=False, readonly=True, states={'draft': [('readonly', False)]}), @@ -310,21 +306,23 @@ class hr_payslip(osv.osv): def account_check_sheet(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'accont_check'}, context=context) - + def hr_check_sheet(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'hr_check'}, context=context) - + def process_sheet(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'paid': True, 'state': 'done'}, context=context) + def hr_verify_sheet(self, cr, uid, ids, context=None): + return self.write(cr, uid, ids, {'state': 'verify'}, context=context) + def refund_sheet(self, cr, uid, ids, context=None): mod_obj = self.pool.get('ir.model.data') wf_service = netsvc.LocalService("workflow") for id in ids: id_copy = self.copy(cr, uid, id, {'credit_note': True}, context=context) self.compute_sheet(cr, uid, [id_copy], context=context) - wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'verify_sheet', cr) - wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'final_verify_sheet', cr) + wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'hr_verify_sheet', cr) wf_service.trg_validate(uid, 'hr.payslip', id_copy, 'process_sheet', cr) form_id = mod_obj.get_object_reference(cr, uid, 'hr_payroll', 'view_hr_payslip_form') @@ -347,6 +345,9 @@ class hr_payslip(osv.osv): def verify_sheet(self, cr, uid, ids, context=None): return self.write(cr, uid, ids, {'state': 'confirm'}, context=context) + + def check_done(self, cr, uid, ids, context=None): + return True #TODO move this function into hr_contract module, on hr.employee object def get_contract(self, cr, uid, employee, date_from, date_to, context=None): diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml index 75823a48761..53e76aec51d 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -330,13 +330,11 @@ -