[Erp5-report] r32045 kazuhiko - /erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jan 28 05:57:44 CET 2010
Author: kazuhiko
Date: Thu Jan 28 05:57:43 2010
New Revision: 32045
URL: http://svn.erp5.org?rev=32045&view=rev
Log:
add a missing import.
Modified:
erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py
Modified: erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py?rev=32045&r1=32044&r2=32045&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py [utf8] Thu Jan 28 05:57:43 2010
@@ -29,7 +29,7 @@
import zope.interface
from AccessControl import ClassSecurityInfo
-from Products.CMFCore.utils import getToolByName
+from Acquisition import aq_base
from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.mixin.solver import SolverMixin
@@ -76,12 +76,19 @@
split_list = delivery_solver.setTotalQuantity(decision_quantity)
# Create split movements
for (simulation_movement, split_quantity) in split_list:
+ split_index = 0
+ new_id = "%s_split_%s" % (simulation_movement.getId(), split_index)
+ applied_rule = simulation_movement.getParentValue()
+ while getattr(aq_base(applied_rule), new_id, None) is not None:
+ split_index += 1
+ new_id = "%s_split_%s" % (simulation_movement.getId(), split_index)
# Copy at same level
kw = _getPropertyAndCategoryList(simulation_movement)
kw.update({'portal_type':simulation_movement.getPortalType(),
- 'delivery':None,
- 'quantity':split_quantity})
- new_movement = simulation_movement.getParentValue().newContent(**kw)
+ 'id':new_id,
+ 'delivery':None,
+ 'quantity':split_quantity})
+ new_movement = applied_rule.newContent(**kw)
start_date = configuration_dict.get('start_date', None)
if start_date is not None:
new_movement.recordProperty('start_date')
More information about the Erp5-report
mailing list