Commit 27b6a02b authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

do not use copy&paste way but use newContent with _getPropertyAndCategoryList...

do not use copy&paste way but use newContent with _getPropertyAndCategoryList result, because copy&paste requires another permission.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31673 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8c133bc7
......@@ -34,6 +34,7 @@ from Products.ERP5Type import Permissions, PropertySheet, interfaces
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 @@ class QuantitySplitSolver(SolverMixin, ConfigurableMixin, XMLObject):
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()
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