Commit 4d035e24 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Ensure that activate_kw is propagated everywhere.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38269 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent fbb5132f
...@@ -365,6 +365,10 @@ class DeliveryBuilder(OrderBuilder): ...@@ -365,6 +365,10 @@ class DeliveryBuilder(OrderBuilder):
delete_id_list = [x.getId() for x in delivery.contentValues() \ delete_id_list = [x.getId() for x in delivery.contentValues() \
if x.getId() not in keep_id_list] if x.getId() not in keep_id_list]
delivery.deleteContent(delete_id_list) delivery.deleteContent(delete_id_list)
if activate_kw:
# XXX _duplicate does not accept activate_kw. So reindex the new
# delivery again with activate_kw.
delivery.reindexObject(activate_kw=activate_kw)
return delivery return delivery
...@@ -403,6 +407,10 @@ class DeliveryBuilder(OrderBuilder): ...@@ -403,6 +407,10 @@ class DeliveryBuilder(OrderBuilder):
delete_id_list = [x.getId() for x in delivery_line.contentValues() \ delete_id_list = [x.getId() for x in delivery_line.contentValues() \
if x.getId() not in keep_id_list] if x.getId() not in keep_id_list]
delivery_line.deleteContent(delete_id_list) delivery_line.deleteContent(delete_id_list)
if activate_kw:
# XXX _duplicate does not accept activate_kw. So reindex the new
# delivery line again with activate_kw.
delivery_line.reindexObject(activate_kw=activate_kw)
return delivery_line return delivery_line
...@@ -430,5 +438,9 @@ class DeliveryBuilder(OrderBuilder): ...@@ -430,5 +438,9 @@ class DeliveryBuilder(OrderBuilder):
parent._duplicate(parent.manage_copyObjects(ids=ids))[0], parent._duplicate(parent.manage_copyObjects(ids=ids))[0],
(delivery_line, old_cell.getId()), {}, CopyError) (delivery_line, old_cell.getId()), {}, CopyError)
cell = delivery_line[cp['new_id']] cell = delivery_line[cp['new_id']]
if activate_kw:
# XXX _duplicate does not accept activate_kw. So reindex the new
# cell again with activate_kw.
cell.reindexObject(activate_kw=activate_kw)
return cell return cell
...@@ -407,8 +407,6 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -407,8 +407,6 @@ class OrderBuilder(XMLObject, Amount, Predicate):
""" """
Build delivery from a list of movement Build delivery from a list of movement
""" """
# FIXME make sure that activate_kw is used for all active objects
# generated from this method and methods called from this method.
if movement_group_node_list is None: if movement_group_node_list is None:
movement_group_node_list = [] movement_group_node_list = []
if divergence_list is None: if divergence_list is None:
...@@ -458,7 +456,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -458,7 +456,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Put properties on delivery # Put properties on delivery
if property_dict: if property_dict:
property_dict.setdefault('edit_order', ('stop_date', 'start_date')) property_dict.setdefault('edit_order', ('stop_date', 'start_date'))
delivery.edit(**property_dict) delivery.edit(activate_kw=activate_kw, **property_dict)
# Then, create delivery lines # Then, create delivery lines
delivery_line_portal_type = self.getDeliveryLinePortalType() delivery_line_portal_type = self.getDeliveryLinePortalType()
...@@ -539,7 +537,8 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -539,7 +537,8 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Put properties on delivery line # Put properties on delivery line
if property_dict: if property_dict:
property_dict.setdefault('edit_order', ('stop_date', 'start_date')) property_dict.setdefault('edit_order', ('stop_date', 'start_date'))
delivery_line.edit(force_update=1, **property_dict) delivery_line.edit(force_update=1, activate_kw=activate_kw,
**property_dict)
if movement_group_node.getCurrentMovementGroup().isBranch(): if movement_group_node.getCurrentMovementGroup().isBranch():
delivery_line_portal_type = self.getDeliveryLinePortalType() delivery_line_portal_type = self.getDeliveryLinePortalType()
...@@ -563,7 +562,8 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -563,7 +562,8 @@ class OrderBuilder(XMLObject, Amount, Predicate):
for movement in movement_group_node.getMovementList(): for movement in movement_group_node.getMovementList():
variation_category_set.update(movement.getVariationCategoryList()) variation_category_set.update(movement.getVariationCategoryList())
variation_category_list = sorted(variation_category_set) variation_category_list = sorted(variation_category_set)
delivery_line.setVariationCategoryList(variation_category_list) delivery_line.edit(variation_category_list=variation_category_list,
activate_kw=activate_kw)
# Then, create delivery movement (delivery cell or complete delivery # Then, create delivery movement (delivery cell or complete delivery
# line) # line)
grouped_node_list = movement_group_node.getGroupList() grouped_node_list = movement_group_node.getGroupList()
...@@ -690,6 +690,8 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -690,6 +690,8 @@ class OrderBuilder(XMLObject, Amount, Predicate):
cell = self._createDeliveryCell(delivery_line, movement, cell = self._createDeliveryCell(delivery_line, movement,
activate_kw, base_id, cell_key) activate_kw, base_id, cell_key)
vcl = movement.getVariationCategoryList() vcl = movement.getVariationCategoryList()
# _createDeliveryCell calls reindexObject, so no need to use
# edit here.
cell._edit(category_list=vcl, cell._edit(category_list=vcl,
# XXX hardcoded value # XXX hardcoded value
mapped_value_property_list=('quantity', 'price'), mapped_value_property_list=('quantity', 'price'),
...@@ -722,7 +724,8 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -722,7 +724,8 @@ class OrderBuilder(XMLObject, Amount, Predicate):
property_dict['quantity'] = simulation_movement.getQuantity() property_dict['quantity'] = simulation_movement.getQuantity()
property_dict['price'] = simulation_movement.getPrice() property_dict['price'] = simulation_movement.getPrice()
# Update properties on object (quantity, price...) # Update properties on object (quantity, price...)
delivery_movement._edit(force_update=1, **property_dict) delivery_movement.edit(force_update=1, activate_kw=activate_kw,
**property_dict)
@UnrestrictedMethod @UnrestrictedMethod
def callAfterBuildingScript(self, delivery_list, movement_list=None, **kw): def callAfterBuildingScript(self, delivery_list, movement_list=None, **kw):
......
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