• Jérome Perrin's avatar
    simulation: introduce MovementGeneratorMixin._updateGeneratedMovementList · 93a0f39f
    Jérome Perrin authored
    This allows custom movement generators to set ad-hoc properties on
    generated movements depending on properties of the corresponding
    input movement.
    
    There was already _getUpdatePropertyDict which is similar, but was
    sometimes not enough because it can only be use to set extra
    properties on all movements.
    
    As a result, when we needed a rule with custom properties on
    generated movements, we resorted to overriding getGeneratedMovementList
    and duplicating the full logic of the method. Existing cases have
    been updated to use the new _updateGeneratedMovementList and in the
    case of InventoryAssetPriceAccountingRuleMovementGenerator we no
    longer need to duplicate the logic.
    
    Also remove the comment suggesting overriding getGeneratedMovementList
    in subclasses, now several "extension" methods exists, so it should
    not be needed to override getGeneratedMovementList, every needs
    should be coverred by defining _updateGeneratedMovementList or
    _getUpdatePropertyDict
    93a0f39f
document.erp5.InvoiceTransactionSimulationRule.py 6.88 KB