From 22c2b27b3a70b11603b18da9eff7373f15ccce80 Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 16 May 2011 18:57:39 +0530 Subject: [PATCH 1/6] [IMP] hr_payroll: changed label of field quantity on Payslip input into 'Amount' bzr revid: mtr@mtr-20110516132739-bay9gf9tpolxagsx --- addons/hr_payroll/hr_payroll.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index b70b30676a8..cd7c08144bf 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -660,7 +660,7 @@ class hr_payslip_input(osv.osv): 'payslip_id': fields.many2one('hr.payslip', 'Pay Slip', required=True), 'sequence': fields.integer('Sequence', required=True,), 'code': fields.char('Code', size=52, required=True, help="The code that can be used in the salary rules"), - 'quantity': fields.float('Quantity', help="It is used in computation. For e.g. A rule for sales having 1% commission of basic salary for per product can defined in expression like result = inputs['S-ASUS']['qunatity']*contract.wage*0.01."), + 'quantity': fields.float('Amount', help="It is used in computation. For e.g. A rule for sales having 1% commission of basic salary for per product can defined in expression like result = inputs['S-ASUS']['qunatity']*contract.wage*0.01."), 'contract_id': fields.many2one('hr.contract', 'Contract', required=True, help="The contract for which applied this input"), } _order = 'payslip_id, sequence' From 0df1f0680159cb8713ba4b194664076cf171bed5 Mon Sep 17 00:00:00 2001 From: mtr Date: Tue, 17 May 2011 16:21:55 +0530 Subject: [PATCH 2/6] [IMP] hr_payroll: improved payslip states(draft, verify, done) and workflow bzr revid: mtr@mtr-20110517105155-d4dp2tt7d7ut4jxd --- addons/hr_payroll/hr_payroll.py | 27 +++++--- addons/hr_payroll/hr_payroll_view.xml | 7 +- addons/hr_payroll/hr_payroll_workflow.xml | 81 ++++++++++++++--------- 3 files changed, 72 insertions(+), 43 deletions(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index b70b30676a8..9ac05332801 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -255,12 +255,16 @@ 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'), + ('draft', 'Draft'), + ('verify', 'Verify'), + ('done', 'Done'), ('cancel', 'Reject'), +# ('draft', 'Waiting for Verification'), +# ('hr_check', 'Waiting for HR Verification'), +# ('accont_check', 'Waiting for Account Verification'), +# ('confirm', 'Confirm Sheet'), +# ('done', 'Paid Salary'), +# ('cancel', 'Reject'), ], '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\'. \ @@ -310,21 +314,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 +353,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(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 4d422d708de..4393f25b9d9 100644 --- a/addons/hr_payroll/hr_payroll_view.xml +++ b/addons/hr_payroll/hr_payroll_view.xml @@ -329,13 +329,14 @@ -