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:
property_list = []
if len(divergence_list):
divergence_scope = self._movement_group.getDivergenceScope()
if divergence_scope is None:
# Update anyway (eg. CausalityAssignmentMovementGroup etc.)
pass
else:
related_divergence_list = [
x for x in divergence_list \
if divergence_scope == x.divergence_scope and \
self.hasSimulationMovement(x.simulation_movement)]
if not len(related_divergence_list):
if divergence_scope is not None:
for divergence in divergence_list:
if (divergence_scope == getattr(divergence, 'divergence_scope',
# assume match if missing
# (e.g. for new simulation)
divergence_scope) and
self.hasSimulationMovement(divergence.simulation_movement)):
property_list.append(divergence.tested_property)
if not property_list:
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,
property_list=property_list)
else:
......
......@@ -311,7 +311,6 @@ class TestAdvancedInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase):
self.assertEquals([], packing_list.getDivergenceList())
self.assertEquals('solved', packing_list.getCausalityState())
@newSimulationExpectedFailure
def test_AdoptQuantityDivergenceOnInvoiceLineWithStoppedPackingList(self, quiet=quiet,
run=RUN_ALL_TESTS):
"""Adopt quantity with stopped packing list"""
......@@ -1040,7 +1039,6 @@ class TestAdvancedSaleInvoice(TestAdvancedInvoice):
""")
sequence_list.play(self, quiet=quiet)
@newSimulationExpectedFailure
def test_13_acceptQuantityDivergenceOnInvoiceWithStartedPackingList(
self, quiet=quiet, run=RUN_ALL_TESTS):
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