Commit 4586d599 authored by Fabien Morin's avatar Fabien Morin

use base_application and base_contribution from model line instead of...

use base_application and base_contribution from model line instead of base_amount (from model line and from payroll service)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25124 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 32548612
...@@ -300,7 +300,7 @@ class PaySheetTransaction(Invoice): ...@@ -300,7 +300,7 @@ class PaySheetTransaction(Invoice):
''' '''
paysheet = self paysheet = self
if not batch_mode and listbox is not None: if not batch_mode and listbox is not None:
model_line_dict = paysheet.getEditableModelLineAsDict(listbox=listbox, model_line_dict = paysheet.getEditableModelLineAsDict(listbox=listbox,
...@@ -319,12 +319,6 @@ class PaySheetTransaction(Invoice): ...@@ -319,12 +319,6 @@ class PaySheetTransaction(Invoice):
def sortByIntIndex(a, b): def sortByIntIndex(a, b):
return cmp(a.getIntIndex(), b.getIntIndex()) return cmp(a.getIntIndex(), b.getIntIndex())
# XXX should this be recursive ? then should membership be strict
base_amount_list = paysheet.portal_categories['base_amount'].contentValues()
base_amount_list.sort(sortByIntIndex)
# get model lines # get model lines
portal_type_list = ['Pay Sheet Model Line'] portal_type_list = ['Pay Sheet Model Line']
sub_object_list = paysheet.getInheritedObjectValueList(portal_type_list) sub_object_list = paysheet.getInheritedObjectValueList(portal_type_list)
...@@ -350,9 +344,8 @@ class PaySheetTransaction(Invoice): ...@@ -350,9 +344,8 @@ class PaySheetTransaction(Invoice):
model_line.getRelativeUrl()) model_line.getRelativeUrl())
title = model_line.getTitleOrId() title = model_line.getTitleOrId()
int_index = model_line.getFloatIndex() int_index = model_line.getFloatIndex()
base_amount_list = model_line.getBaseAmountList()
resource = service.getRelativeUrl() resource = service.getRelativeUrl()
base_participation_list = service.getBaseAmountList() base_contribution_list = model_line.getBaseContributionList()
# get the service provider, either on the model line, or using the # get the service provider, either on the model line, or using the
# annotation line reference. # annotation line reference.
...@@ -484,22 +477,21 @@ class PaySheetTransaction(Invoice): ...@@ -484,22 +477,21 @@ class PaySheetTransaction(Invoice):
if quantity and price: if quantity and price:
cell_list.append(cell_dict) cell_list.append(cell_dict)
# update the base_participation # update the base_contribution
for base_participation in base_participation_list: for base_contribution in base_contribution_list:
base_participation = 'base_amount/%s' % base_participation
if quantity: if quantity:
if base_amount_dict.has_key(base_participation) and \ if base_amount_dict.has_key(base_contribution) and \
base_amount_dict[base_participation].has_key(share): base_amount_dict[base_contribution].has_key(share):
old_val = base_amount_dict[base_participation][share] old_val = base_amount_dict[base_contribution][share]
else: else:
old_val = 0 old_val = 0
new_val = old_val + quantity new_val = old_val + quantity
if not base_amount_dict.has_key(base_participation): if not base_amount_dict.has_key(base_contribution):
base_amount_dict[base_participation]={} base_amount_dict[base_contribution]={}
if price: if price:
new_val = round((old_val + quantity*price), precision) new_val = round((old_val + quantity*price), precision)
base_amount_dict[base_participation][share] = new_val base_amount_dict[base_contribution][share] = new_val
if cell_list: if cell_list:
# create the PaySheetLine # create the PaySheetLine
...@@ -511,7 +503,7 @@ class PaySheetTransaction(Invoice): ...@@ -511,7 +503,7 @@ class PaySheetTransaction(Invoice):
desc=desc, desc=desc,
# TODO: this is base_contribution, # TODO: this is base_contribution,
# not base_amount # not base_amount
base_amount_list=base_participation_list, base_amount_list=base_contribution_list,
cell_list=cell_list, cell_list=cell_list,
categories=categories) categories=categories)
pay_sheet_line_list.append(pay_sheet_line) pay_sheet_line_list.append(pay_sheet_line)
......
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