diff --git a/product/ERP5/Document/TradeModelLine.py b/product/ERP5/Document/TradeModelLine.py index f5b8119385482348a8eaa9872a2f319924f7f8c2..755c0ed132dd9d1db10964ed1b6ea996544107e6 100644 --- a/product/ERP5/Document/TradeModelLine.py +++ b/product/ERP5/Document/TradeModelLine.py @@ -201,6 +201,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): 'stop_date': context.getStopDate(), 'create_line': self.isCreateLine(), 'trade_phase_list': self.getTradePhaseList(), + 'efficiency': self.getEfficiency(), } common_params.update(property_dict) @@ -223,6 +224,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): variation_base_category_list = cell.getVariationBaseCategoryList(), variation_category_list = cell.getVariationCategoryList(), price = cell.getPrice(), + base_quantity = cell.getQuantity(0.0), quantity = cell.getQuantity(0.0), **common_params ) @@ -231,6 +233,7 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): tmp_movement = newTempSimulationMovement(self.getPortalObject(), self_id, quantity = self.getQuantity(0.0), + base_quantity = self.getQuantity(0.0), price = self.getPrice(), **common_params ) @@ -255,10 +258,17 @@ class TradeModelLine(Predicate, XMLMatrix, Amount): # at least one base application is in base contributions and # if the movement have no variation category, it's the same as # if he have all variation categories - quantity = tmp_movement.getQuantity(0.0) + original_quantity = tmp_movement.getQuantity(0.0) + total_price = movement.getTotalPrice() + base_quantity = original_quantity + total_price + quantity = original_quantity + total_price * self.getEfficiency() modified = 1 - tmp_movement.setQuantity(quantity + movement.getTotalPrice()) - + rounding_method = self.getRoundingMethod() + if rounding_method: + roundQuantity = getattr(self, 'TradeModelLine_roundQuantity', None) + if roundQuantity is not None: + quantity = roundQuantity(context, quantity, rounding_method) + tmp_movement.edit(base_quantity=base_quantity, quantity=quantity) else: # if the quantity is defined, use it modified = 1 diff --git a/product/ERP5/PropertySheet/TradeModelLine.py b/product/ERP5/PropertySheet/TradeModelLine.py index a851266de5d2a67dc8dfd5df7ad8bb5ebc368e8f..48c1d484c31cf2572a6eb4277ca0b0c0a70e68d3 100644 --- a/product/ERP5/PropertySheet/TradeModelLine.py +++ b/product/ERP5/PropertySheet/TradeModelLine.py @@ -48,5 +48,5 @@ class TradeModelLine: ) _categories = ( - 'base_application', 'base_contribution', 'trade_phase', + 'base_application', 'base_contribution', 'trade_phase', 'rounding_method', )