Commit 82a824ac authored by Fabien Morin's avatar Fabien Morin

- change base_amount_table in a simple dict with just the base_amount as key

  (remove the tax_category key because the base_amount is the same for all the
tax_category).
- change base_amount_table name in base_amount_current_value_dict wich is a
  litle more clear


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17767 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d5b62e05
......@@ -254,8 +254,8 @@ class PaySheetTransaction(Invoice):
# in this dictionary will be saved the current amount corresponding to
# the tuple (tax_category, base_amount) :
# current_amount = base_amount_table[(tax_category, base_amount)]
base_amount_table = {}
# current_amount = base_amount_current_value_dict[base_amount]
base_amount_current_value_dict = {}
def sortByIntIndex(a, b):
return cmp(a.getIntIndex(),
......@@ -280,12 +280,12 @@ class PaySheetTransaction(Invoice):
for paysheetcell in paysheetcell_list:
tax_category = paysheetcell.getTaxCategory(base=1)
if tax_category and paysheetcell.getQuantity():
if base_amount_table.has_key((tax_category, base_amount)):
old_val = base_amount_table[(tax_category, base_amount)]
if base_amount_current_value_dict.has_key(base_amount):
old_val = base_amount_current_value_dict[base_amount]
else:
old_val = 0
new_val = old_val + paysheetcell.getQuantity()
base_amount_table[(tax_category, base_amount)] = new_val
base_amount_current_value_dict[base_amount] = new_val
# get not editables model lines
model = self.getSpecialiseValue()
......@@ -353,11 +353,11 @@ class PaySheetTransaction(Invoice):
LOG('script_name :',0,script_name)
calculation_script = getattr(self, script_name, None)
result = calculation_script(\
base_amount_table=base_amount_table,
share=share,
model_slice_min=model_slice_min,
model_slice_max=model_slice_max,
cell=cell,)
base_amount_current_value_dict=base_amount_current_value_dict,
share=share,
model_slice_min=model_slice_min,
model_slice_max=model_slice_max,
cell=cell,)
quantity = result['quantity']
price = result['price']
......@@ -381,8 +381,8 @@ class PaySheetTransaction(Invoice):
base_participation_list = service.getBaseAmountList(base=1)
for base_participation in base_participation_list:
if quantity:
if base_amount_table.has_key((share, base_participation)):
old_val = base_amount_table[(share, base_participation)]
if base_amount_current_value_dict.has_key(base_participation):
old_val = base_amount_current_value_dict[base_participation]
else:
old_val = 0
new_val = old_val + quantity
......@@ -390,7 +390,7 @@ class PaySheetTransaction(Invoice):
if price:
if old_val != 0:
new_val = round((old_val + quantity*price), precision)
base_amount_table[(share, base_participation)] = new_val
base_amount_current_value_dict[base_participation] = new_val
if cell_list:
# create the PaySheetLine
......
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