• Jérome Perrin's avatar
    composition: only consider validated when looking up effective models · 5d929056
    Jérome Perrin authored
    composition API, which is used to select the "most applicable" model
    (Trade Condition, Transformation, Pay Sheet Model, etc) with the same
    reference was only discarding deleted and validated models, but it
    was selecting draft models.
    
    This leads to this kind of problem:
     - A validated model exist, with an effective date
     - A new model is made by cloning the validated one, edited to set
      effective date from now and validated
     - The first validated model is also cloned by mistake, but not
      validated
    In such case, the model cloned by mistake might be used, which from
    user point of view is wrong, because user validated a model, so if
    the system use a draft instead, that's a very wrong behaviour.
    
    This change require models to be validated for the composition API to
    work, many tests were updated to validate the model (either in the test
    or in the data business template used by the test).
    
    This change might also produce different results in production, because
    it was possible that some draft models were selected before, now they
    will no longer be selected. To check for potential side effects, we
    recommend looking for all draft models with a reference, examine them
    one by one and validate the model if it's a case where user forgot to
    validate.
    5d929056
test.erp5.testPayroll.py 160 KB