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

Reexpand when necessary for invoice transaction rule, where the "do not expand...

Reexpand when necessary for invoice transaction rule, where the "do not expand if it has already been expanded" behaviour doesn't always work (when you change a category on the line that would change Invoice Transaction Rule's matching cell)


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4669 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3fc45045
...@@ -200,8 +200,6 @@ class SimulationMovement(Movement): ...@@ -200,8 +200,6 @@ class SimulationMovement(Movement):
security.declareProtected(Permissions.ModifyPortalContent, 'expand') security.declareProtected(Permissions.ModifyPortalContent, 'expand')
def expand(self, **kw): def expand(self, **kw):
""" """
-> new status : expanded
Parses all existing applied rules and make sure they apply. Parses all existing applied rules and make sure they apply.
Checks other possible rules and starts expansion process Checks other possible rules and starts expansion process
(instanciates rule and calls expand on rule) (instanciates rule and calls expand on rule)
...@@ -209,45 +207,31 @@ class SimulationMovement(Movement): ...@@ -209,45 +207,31 @@ class SimulationMovement(Movement):
Only movements which applied rule parent is expanded can Only movements which applied rule parent is expanded can
be expanded. be expanded.
""" """
#LOG('In simulation expand',0, str(self.id)) # XXX Default behaviour is not to expand if it has already been
# self.reindexObject() # expanded, but some rules are configuration rules and need to be
if self.getCausalityState() == 'expanded': # reexpanded each time, because the rule apply only if predicates
# are true, then this kind of rule must always be tested. Currently,
# we know that invoicing rule acts like this, and that it comes after
# invoice or invoicing_rule, so we if we come from invoince rule or
# invoicing rule, we always expand regardless of the causality state.
if (self.getParent().getSpecialiseId() not in
('default_invoicing_rule', 'default_invoice_rule')
and self.getCausalityState() == 'expanded' ) or \
len(self.objectIds()) != 0:
# Reexpand # Reexpand
for my_applied_rule in self.objectValues(): for my_applied_rule in self.objectValues():
my_applied_rule.expand(**kw) my_applied_rule.expand(**kw)
else: else:
portal_rules = getToolByName(self, 'portal_rules') portal_rules = getToolByName(self, 'portal_rules')
# Parse each applied rule and test if it applied
#for applied_rule in self.objectValues():
# if not applied_rule.test():
# # delete
# Parse each rule and test if it applies # Parse each rule and test if it applies
for rule in portal_rules.objectValues(): for rule in portal_rules.objectValues():
if rule.test(self): if rule.test(self):
my_applied_rule = rule.constructNewAppliedRule(self,**kw) my_applied_rule = rule.constructNewAppliedRule(self, **kw)
for my_applied_rule in self.objectValues() :
my_applied_rule.expand(**kw) my_applied_rule.expand(**kw)
# Set to expanded # Set to expanded
self.setCausalityState('expanded') self.setCausalityState('expanded')
#expand = WorkflowMethod(expand) USELESS NOW
# XXX moved to Portal Simulation
# security.declareProtected(Permissions.ModifyPortalContent, 'solve')
# def solve(self, solver, new_target=None):
# """
# Makes the movement expandable again
#
# -> new status -> solved
#
# Once a movement has been updated with consistent
# target and planned values, it is marked as solved
# and can therefore be expanded again
# """
# self.portal_simulation.applyTargetSolver(self, solver, new_target=new_target)
# self.setCausalityState('solved')
#
# #solve = WorkflowMethod(solve) USELESS NOW
security.declareProtected(Permissions.ModifyPortalContent, 'diverge') security.declareProtected(Permissions.ModifyPortalContent, 'diverge')
def diverge(self): def diverge(self):
""" """
......
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