[Erp5-report] r25466 - /erp5/trunk/products/ERP5/Document/PaySheetTransaction.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Feb 5 18:53:01 CET 2009


Author: fabien
Date: Thu Feb  5 18:53:00 2009
New Revision: 25466

URL: http://svn.erp5.org?rev=25466&view=rev
Log:
- search the model line using the title too.
- use the method getAnnotationLineFromReference to search the corresponding annotation line instead of duplicate code

Modified:
    erp5/trunk/products/ERP5/Document/PaySheetTransaction.py

Modified: erp5/trunk/products/ERP5/Document/PaySheetTransaction.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/PaySheetTransaction.py?rev=25466&r1=25465&r2=25466&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/PaySheetTransaction.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/PaySheetTransaction.py [utf8] Thu Feb  5 18:53:00 2009
@@ -118,12 +118,12 @@
     annotation_line_list = self.contentValues(portal_type=['Annotation Line'])
     if annotation_line_list:
       for annotation_line in annotation_line_list:
-        if annotation_line.getReference() == reference:
+        if (annotation_line.getReference() or annotation_line.getId()) == reference :
           return annotation_line
 
     # if not find in the paysheet, look on dependence tree
     for annotation_line in self.getInheritedObjectValueList(['Annotation Line']):
-      if annotation_line.getReference() == reference:
+      if (annotation_line.getReference() or annotation_line.getId()) == reference:
         return annotation_line
 
     return None 
@@ -355,14 +355,9 @@
       if model_line.getSource():
         source_section = model_line.getSource()
       elif source_annotation_line_reference:
-        for annotation_line in paysheet.contentValues(
-                                    portal_type='Annotation Line'):
-          annotation_line_reference = annotation_line.getReference() \
-                                           or annotation_line.getId()
-          if annotation_line_reference == source_annotation_line_reference \
-              and annotation_line.getSource():
-            source_section = annotation_line.getSource()
-            break
+        annotation_line = paysheet.getAnnotationLineFromReference(source_annotation_line_reference)
+        if annotation_line is not None:
+          source_section = annotation_line.getSource()
 
       if model_line.getDescription():
         desc = model_line.getDescription()
@@ -412,7 +407,7 @@
 
           def getModifiedCell(cell, slice_dict, tax_category):
             '''
-              return a cell with the modified values (contained in slice_dict)
+              return a cell with the edited values (contained in slice_dict)
             '''
             if slice_dict:
               if slice_dict.has_key(tax_category):




More information about the Erp5-report mailing list