Commit e7fe0313 authored by Romain Courteaud's avatar Romain Courteaud 🐸

Even if delivered, we should always calculate consequences (like in

DeliveryRule).
Simulation state which can expand simulation must be defined in workflows, not
in rule.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3718 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7e99df49
...@@ -61,7 +61,7 @@ class InvoiceRule(DeliveryRule): ...@@ -61,7 +61,7 @@ class InvoiceRule(DeliveryRule):
# Simulation workflow # Simulation workflow
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, applied_rule, force=0, **kw): def expand(self, applied_rule, **kw):
""" """
Expands the current movement downward. Expands the current movement downward.
...@@ -76,14 +76,6 @@ class InvoiceRule(DeliveryRule): ...@@ -76,14 +76,6 @@ class InvoiceRule(DeliveryRule):
# Only expand if my_invoice is not None and # Only expand if my_invoice is not None and
# state is not 'confirmed' # state is not 'confirmed'
if my_invoice is not None: if my_invoice is not None:
# Only expand invoice rule if invoice not yet confirmed
# (This is consistent with the fact that once simulation is
# launched, we stick to it)
if force or \
(applied_rule.getLastExpandSimulationState() not in \
self.getPortalReservedInventoryStateList() and \
applied_rule.getLastExpandSimulationState() not in \
self.getPortalCurrentInventoryStateList()):
# First, check each contained movement and make # First, check each contained movement and make
# a list of invoice_line ids which do not need to be copied # a list of invoice_line ids which do not need to be copied
# eventually delete movement which do not exist anylonger # eventually delete movement which do not exist anylonger
...@@ -139,9 +131,5 @@ class InvoiceRule(DeliveryRule): ...@@ -139,9 +131,5 @@ class InvoiceRule(DeliveryRule):
LOG('ERP5: WARNING', 0, LOG('ERP5: WARNING', 0,
'AttributeError during expand on invoice line %s' \ 'AttributeError during expand on invoice line %s' \
% invoice_line_object.absolute_url()) % invoice_line_object.absolute_url())
# Now we can set the last expand simulation state to the
# current state
applied_rule.setLastExpandSimulationState(
my_invoice.getSimulationState())
# Pass to base class # Pass to base class
Rule.expand(self, applied_rule, force=force, **kw) Rule.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