Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
my_signal= dispatch.Signal(providing_args=["objinstance","user"])

Use cases

UC14-1: add a new Calculation rule (needs to change the openimis.json).
UC14-2: use the frontend contribution to select a calculation rule.
UC14-3: use the fronend contribution to display the parameters required by multiple calculation for an object.
UC14-4: replace a calculation rule.
UC14-5: remove a calculation rule.

...

This function is required because the same class can have different calculation based on the object members values (like product ….)

calculateEvent(sender, instance, user, **kwargs)
  • This method runs the calculation based on the object sending the signal, this means that the relationship with the other item required for the calculation could be found from the object sending the signal. (e.g., link to the product can be found in the policy as foreign key.)

  • This function should call first the activeForObject method, the context will depend on the calling event, if the fuction return true the calcuation needs to be run, in other case the even handling will stop

  • the calculate(*args) function

  • Signal need to be set up on the ready function to call it

...

Function that fetches the args from the UUID [order specific ?] then run the calculate(instance, *args) function.

calculate(instance, *args)

Function that will do the calculation based on the parameters

...