Commit 0c3b1fce authored by Fabien Morin's avatar Fabien Morin

- get common params before entering in the loop. This should save some calculation time.

- add start and stop_date properties to the created movments


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27537 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0e4c1ed3
...@@ -131,6 +131,17 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -131,6 +131,17 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
tmp_movement_list = tmp_movement_list[:1] tmp_movement_list = tmp_movement_list[:1]
update = 1 update = 1
else: else:
common_params = {
'causality':self.getRelativeUrl(),
'resource':self.getResource(),
'reference':self.getReference(),
'base_application_list':base_application_list,
'base_contribution_list':self.getBaseContributionList(),
'start_date':context.getStartDate(),
'stop_date':context.getStopDate(),
'create_line':self.isCreateLine(),
'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 = []
...@@ -151,30 +162,18 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): ...@@ -151,30 +162,18 @@ class TradeModelLine(Predicate, XMLMatrix, Amount):
tmp_movement.edit( 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(),
causality = self.getRelativeUrl(),
resource = self.getResource(),
reference = self.getReference(),
base_application_list = base_application_list,
base_contribution_list = self.getBaseContributionList(),
price = cell.getPrice(), price = cell.getPrice(),
quantity = cell.getQuantity(0.0), quantity = cell.getQuantity(0.0),
create_line = self.isCreateLine(), **common_params
trade_phase_list = self.getTradePhaseList(),
) )
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( tmp_movement.edit(
causality = self.getRelativeUrl(),
resource = self.getResource(),
reference = self.getReference(),
base_application_list = base_application_list,
base_contribution_list = self.getBaseContributionList(),
quantity = self.getQuantity(0.0), quantity = self.getQuantity(0.0),
price = self.getPrice(), price = self.getPrice(),
create_line = self.isCreateLine(), **common_params
trade_phase_list = self.getTradePhaseList(),
) )
tmp_movement_list.append(tmp_movement) tmp_movement_list.append(tmp_movement)
modified = 0 modified = 0
......
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