Commit af0c874f authored by Fabien Morin's avatar Fabien Morin

- add a check to not delete the paysheet in case where paysheet lines should be deleted

- add a condition to not return movement with 0 total_price


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27846 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a2e63cf1
......@@ -162,7 +162,8 @@ class PaySheetTransaction(Invoice):
movement_dict = paysheet_model.updateAggregatedAmountList(context=self)
for movement in movement_dict['movement_to_delete_list']:
parent = movement.getParentValue()
parent.manage_delObjects(movement.getId())
if parent.getPortalType() == 'Pay Sheet Line':
parent.manage_delObjects(movement.getId())
if len(parent.contentValues(portal_type='Pay Sheet Cell')) == 0:
# the line contain no movements, remove it
self.manage_delObjects(parent.getId())
......@@ -176,10 +177,12 @@ class PaySheetTransaction(Invoice):
business_process = business_process_list[0]
movement_list_trade_phase_dic = {}
for movement in movement_dict['movement_to_add_list']:
trade_phase = movement.getTradePhase()
if not movement_list_trade_phase_dic.has_key(trade_phase):
movement_list_trade_phase_dic[trade_phase] = []
movement_list_trade_phase_dic[trade_phase].append(movement)
if movement.getTotalPrice() != 0:
# remove movement with 0 total_price
trade_phase = movement.getTradePhase()
if not movement_list_trade_phase_dic.has_key(trade_phase):
movement_list_trade_phase_dic[trade_phase] = []
movement_list_trade_phase_dic[trade_phase].append(movement)
for trade_phase in movement_list_trade_phase_dic.keys():
business_path_list = business_process.getPathValueList(trade_phase=\
......
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