From 17716e83d7c3933058baa988a48bebada0f0840d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Calonne?= <aurel@nexedi.com>
Date: Thu, 23 Dec 2010 08:46:36 +0000
Subject: [PATCH] fix deletion of pay sheet transaction lines & cells

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41696 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/Document/PaySheetTransaction.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/product/ERP5/Document/PaySheetTransaction.py b/product/ERP5/Document/PaySheetTransaction.py
index 745be1b6c8..4d21f6a552 100644
--- a/product/ERP5/Document/PaySheetTransaction.py
+++ b/product/ERP5/Document/PaySheetTransaction.py
@@ -181,9 +181,10 @@ class PaySheetTransaction(Invoice):
     movement_dict = self.updateAggregatedAmountList()
     for movement in movement_dict['movement_to_delete_list']:
       parent = movement.getParentValue()
-      if parent.getPortalType() == 'Pay Sheet Line':
+      if parent.getPortalType() in ['Pay Sheet Line', 'Pay Sheet Transaction']:
         parent.manage_delObjects(movement.getId())
-      if len(parent.contentValues(portal_type='Pay Sheet Cell')) == 0:
+      if parent.getPortalType() == 'Pay Sheet Line' and \
+             len(parent.contentValues(portal_type='Pay Sheet Cell')) == 0:
         # the line contain no movements, remove it
         self.manage_delObjects(parent.getId())
     business_process_list = paysheet_model.findEffectiveSpecialiseValueList(
-- 
2.30.9