Commit 3f8ab009 authored by Łukasz Nowak's avatar Łukasz Nowak

- formatting

 - code simplification (set properties of document while creating one)
 - rewrite comment


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27605 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a6e8e34b
...@@ -106,8 +106,8 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -106,8 +106,8 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
raise ValueError('preferred_normal_resource_use_category is not ' + \ raise ValueError('preferred_normal_resource_use_category is not ' + \
'configured in System Preferences') 'configured in System Preferences')
# if temp_movements are passed as parameters, we want to use it, # if movement_list is passed as parameter, it shall be used,
# otherwise, we will search for simulation movements # otherwise it is needed to look up for movements
if len(movement_list) == 0: if len(movement_list) == 0:
# no movements passed, need to find some # no movements passed, need to find some
if isMovement(context): if isMovement(context):
...@@ -126,6 +126,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -126,6 +126,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
if movement_resource.getUse() in \ if movement_resource.getUse() in \
normal_resource_use_category_list: normal_resource_use_category_list:
movement_list.append(movement) movement_list.append(movement)
aggregated_amount_list = AggregatedAmountList() aggregated_amount_list = AggregatedAmountList()
base_application_list = self.getBaseApplicationList() base_application_list = self.getBaseApplicationList()
...@@ -138,16 +139,16 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -138,16 +139,16 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
update = 1 update = 1
else: else:
common_params = { common_params = {
'causality':self.getRelativeUrl(), 'causality': self.getRelativeUrl(),
'resource':self.getResource(), 'resource': self.getResource(),
'reference':self.getReference(), 'reference': self.getReference(),
'base_application_list':base_application_list, 'base_application_list': base_application_list,
'base_contribution_list':self.getBaseContributionList(), 'base_contribution_list': self.getBaseContributionList(),
'start_date':context.getStartDate(), 'start_date': context.getStartDate(),
'stop_date':context.getStopDate(), 'stop_date': context.getStopDate(),
'create_line':self.isCreateLine(), 'create_line': self.isCreateLine(),
'trade_phase_list':self.getTradePhaseList(), 'trade_phase_list': self.getTradePhaseList(),
} }
update = 0 update = 0
base_category_list = self.getVariationBaseCategoryList() base_category_list = self.getVariationBaseCategoryList()
category_list_list = [] category_list_list = []
...@@ -164,8 +165,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -164,8 +165,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
raise ValueError("Can't find the cell corresponding to those "+\ raise ValueError("Can't find the cell corresponding to those "+\
"cells coordinates : %s" % cell_coordinates) "cells coordinates : %s" % cell_coordinates)
tmp_movement = newTempSimulationMovement(self.getPortalObject(), tmp_movement = newTempSimulationMovement(self.getPortalObject(),
self_id ) self_id,
tmp_movement.edit(
variation_base_category_list = cell.getVariationBaseCategoryList(), variation_base_category_list = cell.getVariationBaseCategoryList(),
variation_category_list = cell.getVariationCategoryList(), variation_category_list = cell.getVariationCategoryList(),
price = cell.getPrice(), price = cell.getPrice(),
...@@ -175,8 +175,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -175,8 +175,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
tmp_movement_list.append(tmp_movement) tmp_movement_list.append(tmp_movement)
else: else:
tmp_movement = newTempSimulationMovement(self.getPortalObject(), tmp_movement = newTempSimulationMovement(self.getPortalObject(),
self_id ) self_id,
tmp_movement.edit(
quantity = self.getQuantity(0.0), quantity = self.getQuantity(0.0),
price = self.getPrice(), price = self.getPrice(),
**common_params **common_params
......
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