Commit 2ee64dca authored by Fabien Morin's avatar Fabien Morin

- add WARNINGS and TODO

- change the method who get annotation/ratio line from a reference to search
  first on the paysheet before on the dependencies model tree
- remove some logs


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18335 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent eea9074c
...@@ -92,10 +92,6 @@ class PaySheetModel(TradeCondition, XMLMatrix): ...@@ -92,10 +92,6 @@ class PaySheetModel(TradeCondition, XMLMatrix):
reference_dict[reference]=object.getId() reference_dict[reference]=object.getId()
elif reference is None and get_none_reference: elif reference is None and get_none_reference:
reference_dict[object.getId()]=object.getId() reference_dict[object.getId()]=object.getId()
else:
LOG('PaySheetModel getReferenceList', 0, '"%s" reference '
'property is empty' % object.getTitle() or
object.getRelativeUrl())
return reference_dict return reference_dict
......
...@@ -33,6 +33,9 @@ from Products.ERP5Type.Utils import cartesianProduct ...@@ -33,6 +33,9 @@ from Products.ERP5Type.Utils import cartesianProduct
import pprint import pprint
from zLOG import LOG from zLOG import LOG
#XXX TODO: review naming of new methods
#XXX WARNING: current API naming may change although model should be stable.
class PaySheetTransaction(Invoice): class PaySheetTransaction(Invoice):
""" """
A paysheet will store data about the salary of an employee A paysheet will store data about the salary of an employee
...@@ -79,12 +82,21 @@ class PaySheetTransaction(Invoice): ...@@ -79,12 +82,21 @@ class PaySheetTransaction(Invoice):
""" """
# get ratio lines # get ratio lines
portal_type_list = ['Pay Sheet Model Ratio Line'] portal_type_list = ['Pay Sheet Model Ratio Line']
object_ratio_list = self.contentValues(portal_type=portal_type_list)
# look for ratio lines on the paysheet
if object_ratio_list:
for object in object_ratio_list:
if object.getReference() == ratio_reference:
return object.getQuantity()
# if not find in the paysheet, look on dependence tree
sub_object_list = self.getSubObjectValueList(portal_type_list) sub_object_list = self.getSubObjectValueList(portal_type_list)
object_ratio_list = sub_object_list object_ratio_list = sub_object_list
for object in object_ratio_list: for object in object_ratio_list:
if object.getReference() == ratio_reference: if object.getReference() == ratio_reference:
return object.getQuantity() return object.getQuantity()
return None return None
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
...@@ -109,12 +121,22 @@ class PaySheetTransaction(Invoice): ...@@ -109,12 +121,22 @@ class PaySheetTransaction(Invoice):
""" """
# get Annotation Lines # get Annotation Lines
portal_type_list = ['Annotation Line'] portal_type_list = ['Annotation Line']
annotation_line_list = self.contentValues(portal_type=portal_type_list)
# look for annotation lines on the paysheet
if annotation_line_list:
for annotation_line in annotation_line_list:
if annotation_line.getReference() == reference:
return annotation_line
# if not find in the paysheet, look on dependence tree
sub_object_list = self.getSubObjectValueList(portal_type_list) sub_object_list = self.getSubObjectValueList(portal_type_list)
annotation_line_list = sub_object_list annotation_line_list = sub_object_list
for annotation_line in annotation_line_list: for annotation_line in annotation_line_list:
if annotation_line.getReference() == reference: if annotation_line.getReference() == reference:
return annotation_line return annotation_line
return None return None
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment