Commit ec6af4d3 authored by Jérome Perrin's avatar Jérome Perrin

Invoice rule should expand all movements, including tax movements


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@20528 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent be990fa9
...@@ -61,7 +61,7 @@ class DeliveryRule(Rule): ...@@ -61,7 +61,7 @@ class DeliveryRule(Rule):
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, **kw): def expand(self, applied_rule, delivery_movement_type_list=None, **kw):
""" """
Expands the additional Delivery movements to a new simulation tree. Expands the additional Delivery movements to a new simulation tree.
Expand is only allowed to create or modify simulation movements for Expand is only allowed to create or modify simulation movements for
...@@ -77,8 +77,11 @@ class DeliveryRule(Rule): ...@@ -77,8 +77,11 @@ class DeliveryRule(Rule):
existing_movement_list = [] existing_movement_list = []
immutable_movement_list = [] immutable_movement_list = []
delivery = applied_rule.getDefaultCausalityValue() delivery = applied_rule.getDefaultCausalityValue()
if delivery_movement_type_list is None:
delivery_movement_type_list = self.getPortalDeliveryMovementTypeList()
if delivery is not None: if delivery is not None:
delivery_movement_list = delivery.getMovementList() delivery_movement_list = delivery.getMovementList(
portal_type=delivery_movement_type_list)
# Check existing movements # Check existing movements
for movement in applied_rule.contentValues(portal_type=movement_type): for movement in applied_rule.contentValues(portal_type=movement_type):
if movement.getLastExpandSimulationState() in \ if movement.getLastExpandSimulationState() in \
...@@ -95,7 +98,7 @@ class DeliveryRule(Rule): ...@@ -95,7 +98,7 @@ class DeliveryRule(Rule):
immutable_movement_list.append(movement) immutable_movement_list.append(movement)
# Create or modify movements # Create or modify movements
for deliv_mvt in delivery.getMovementList(): for deliv_mvt in delivery_movement_list:
sim_mvt = deliv_mvt.getDeliveryRelatedValue() sim_mvt = deliv_mvt.getDeliveryRelatedValue()
if sim_mvt is None: if sim_mvt is None:
# create a new deliv_mvt # create a new deliv_mvt
......
...@@ -73,11 +73,11 @@ class InvoiceRule(DeliveryRule): ...@@ -73,11 +73,11 @@ class InvoiceRule(DeliveryRule):
return 0 return 0
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, def expand(self, applied_rule, **kw):
movement_type_method='getPortalInvoiceMovementTypeList', **kw):
""" """
Call expand defined on DeliveryRule. Call expand defined on DeliveryRule.
""" """
DeliveryRule.expand(self, applied_rule, kw['delivery_movement_type_list'] = \
movement_type_method=movement_type_method, self.getPortalInvoiceMovementTypeList() + \
**kw) self.getPortalTaxMovementTypeList()
DeliveryRule.expand(self, applied_rule, **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