[Erp5-report] r31673 kazuhiko - /erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 11 09:54:13 CET 2010


Author: kazuhiko
Date: Mon Jan 11 09:54:11 2010
New Revision: 31673

URL: http://svn.erp5.org?rev=31673&view=rev
Log:
do not use copy&paste way but use newContent with _getPropertyAndCategoryList result, because copy&paste requires another permission.

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=31673&r1=31672&r2=31673&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/QuantitySplitSolver.py [utf8] Mon Jan 11 09:54:11 2010
@@ -34,6 +34,7 @@
 from Products.ERP5Type.XMLObject import XMLObject
 from Products.ERP5.mixin.solver import SolverMixin
 from Products.ERP5.mixin.configurable import ConfigurableMixin
+from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList
 
 class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
   """
@@ -75,15 +76,18 @@
       split_list = delivery_solver.setTotalQuantity(decision_quantity)
       # Create split movements
       for (simulation_movement, split_quantity) in split_list:
-        new_movement = simulation_movement.Base_createCloneDocument(
-          batch_mode=True) # Copy at same level
-        new_movement._setDelivery(None)
-        new_movement._setQuantity(split_quantity)
+        # Copy at same level
+        kw = _getPropertyAndCategoryList(simulation_movement)
+        kw.update({'portal_type':simulation_movement.getPortalType(),
+                              'delivery':None,
+                              'quantity':split_quantity})
         start_date = configuration_dict.get('start_date', None)
         if start_date is not None:
-          new_movement._setStartDate(start_date)
+          kw['start_date'] = start_date
         stop_date = configuration_dict.get('stop_date', None)
         if stop_date is not None:
-          new_movement._setStopDate(stop_date)
+          kw['stop_date'] = stop_date
+        new_movement = simulation_movement.getParentValue().newContent(**kw)
+
     # Finish solving
     self.succeed()




More information about the Erp5-report mailing list