From 688fe5eed60c54125eabf3c2597def6cb567fc82 Mon Sep 17 00:00:00 2001 From: Fabien Morin <fabien@nexedi.com> Date: Fri, 4 Jan 2008 12:38:15 +0000 Subject: [PATCH] add a condition to not add the cell if it's quantity is None or null git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18595 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/Document/PaySheetTransaction.py | 39 ++++++++++---------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/product/ERP5/Document/PaySheetTransaction.py b/product/ERP5/Document/PaySheetTransaction.py index 4e97f6464c..3fcaa1db84 100644 --- a/product/ERP5/Document/PaySheetTransaction.py +++ b/product/ERP5/Document/PaySheetTransaction.py @@ -487,24 +487,25 @@ class PaySheetTransaction(Invoice): quantity = cell_dict['quantity'] price = cell_dict['price'] - cell_list.append(cell_dict) - - # update the base_participation - base_participation_list = service.getBaseAmountList(base=1) - for base_participation in base_participation_list: - if quantity: - if base_amount_dict.has_key(base_participation) and \ - base_amount_dict[base_participation].has_key(share): - old_val = base_amount_dict[base_participation][share] - else: - old_val = 0 - new_val = old_val + quantity - if not base_amount_dict.has_key(base_participation): - base_amount_dict[base_participation]={} - - if price: - new_val = round((old_val + quantity*price), precision) - base_amount_dict[base_participation][share] = new_val + if quantity: + cell_list.append(cell_dict) + + # update the base_participation + base_participation_list = service.getBaseAmountList(base=1) + for base_participation in base_participation_list: + if quantity: + if base_amount_dict.has_key(base_participation) and \ + base_amount_dict[base_participation].has_key(share): + old_val = base_amount_dict[base_participation][share] + else: + old_val = 0 + new_val = old_val + quantity + if not base_amount_dict.has_key(base_participation): + base_amount_dict[base_participation]={} + + if price: + new_val = round((old_val + quantity*price), precision) + base_amount_dict[base_participation][share] = new_val if cell_list: # create the PaySheetLine @@ -558,7 +559,7 @@ class PaySheetTransaction(Invoice): id_list = model_reference_dict[key] model = self.getPortalObject().restrictedTraverse(key) if model is None: - LOG("copyInheritanceSubObjects,", 0, "can't find model %s" % key) + LOG("getInheritedObjectValueList :", 0, "can't find model %s" % key) for id in id_list: object = model._getOb(id) -- 2.30.9