Commit 998bb1c3 authored by Leonardo Rochael Almeida's avatar Leonardo Rochael Almeida Committed by Julien Muchembled

Fix possible "AttributeError: divergence_scope" when using old way of solving divergences

New simulation movements don't have a .divergence_scope attribute, so
movement groups should not assume their presence when checking scope to
adopt a divergence.
parent fb3f37dc
...@@ -149,17 +149,17 @@ class MovementGroupNode: ...@@ -149,17 +149,17 @@ class MovementGroupNode:
property_list = [] property_list = []
if len(divergence_list): if len(divergence_list):
divergence_scope = self._movement_group.getDivergenceScope() divergence_scope = self._movement_group.getDivergenceScope()
if divergence_scope is None: if divergence_scope is not None:
# Update anyway (eg. CausalityAssignmentMovementGroup etc.) for divergence in divergence_list:
pass if (divergence_scope == getattr(divergence, 'divergence_scope',
else: # assume match if missing
related_divergence_list = [ # (e.g. for new simulation)
x for x in divergence_list \ divergence_scope) and
if divergence_scope == x.divergence_scope and \ self.hasSimulationMovement(divergence.simulation_movement)):
self.hasSimulationMovement(x.simulation_movement)] property_list.append(divergence.tested_property)
if not len(related_divergence_list): if not property_list:
return True, {} return True, {}
property_list = [x.tested_property for x in related_divergence_list] # else update anyway (eg. CausalityAssignmentMovementGroup etc.)
return self._movement_group.test(movement, self._property_dict, return self._movement_group.test(movement, self._property_dict,
property_list=property_list) property_list=property_list)
else: else:
......
...@@ -311,7 +311,6 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): ...@@ -311,7 +311,6 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase):
self.assertEquals([], packing_list.getDivergenceList()) self.assertEquals([], packing_list.getDivergenceList())
self.assertEquals('solved', packing_list.getCausalityState()) self.assertEquals('solved', packing_list.getCausalityState())
@newSimulationExpectedFailure
def test_AdoptQuantityDivergenceOnInvoiceLineWithStoppedPackingList(self, quiet=quiet, def test_AdoptQuantityDivergenceOnInvoiceLineWithStoppedPackingList(self, quiet=quiet,
run=RUN_ALL_TESTS): run=RUN_ALL_TESTS):
"""Adopt quantity with stopped packing list""" """Adopt quantity with stopped packing list"""
...@@ -1040,7 +1039,6 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice): ...@@ -1040,7 +1039,6 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice):
""") """)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
@newSimulationExpectedFailure
def test_13_acceptQuantityDivergenceOnInvoiceWithStartedPackingList( def test_13_acceptQuantityDivergenceOnInvoiceWithStartedPackingList(
self, quiet=quiet, run=RUN_ALL_TESTS): self, quiet=quiet, run=RUN_ALL_TESTS):
if not run: return if not run: return
......
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