From 2c9ef5b3d5c1b5fa586b6a3a9d027f8220e4c1e6 Mon Sep 17 00:00:00 2001 From: Rifakat Date: Mon, 23 Dec 2013 15:48:41 +0530 Subject: [PATCH] [FIX] hr_payroll: put a check for the structure used in the contract. When any structure is already assigned into contract and that is deleted, it will affet the Payslips which were already created and will have [False] value. bzr revid: rha@tinyerp.com-20131223101841-6fbwfm90gn7sj17m --- addons/hr_payroll/hr_payroll.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py index 5fd74ff9fe0..95ae878e40f 100644 --- a/addons/hr_payroll/hr_payroll.py +++ b/addons/hr_payroll/hr_payroll.py @@ -146,7 +146,9 @@ class hr_contract(osv.osv): @return: the structures linked to the given contracts, ordered by hierachy (parent=False first, then first level children and so on) and without duplicata """ all_structures = [] - structure_ids = [contract.struct_id.id for contract in self.browse(cr, uid, contract_ids, context=context)] + structure_ids = [contract.struct_id.id for contract in self.browse(cr, uid, contract_ids, context=context) if contract.struct_id] + if not structure_ids: + return [] return list(set(self.pool.get('hr.payroll.structure')._get_parent_structure(cr, uid, structure_ids, context=context))) hr_contract()