-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from openimis/develop
MERGING RELEASE branches
- Loading branch information
Showing
3 changed files
with
42 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,4 @@ | ||
from calculation.services import run_calculation_rules | ||
from core.models import User | ||
from core.service_signals import ServiceSignalBindType | ||
from core.signals import Signal, bind_service_signal | ||
from policy.models import Policy | ||
from core.signals import Signal | ||
|
||
_check_formal_sector_for_policy_signal_params = ["user", "policy_id"] | ||
signal_check_formal_sector_for_policy = Signal(providing_args=_check_formal_sector_for_policy_signal_params) | ||
|
||
|
||
def bind_service_signals(): | ||
bind_service_signal( | ||
'policy_service.create_or_update', | ||
on_policy_create_or_update, | ||
bind_type=ServiceSignalBindType.AFTER | ||
) | ||
|
||
|
||
def on_policy_create_or_update(**kwargs): | ||
policy = kwargs.get('result', None) | ||
if policy: | ||
if policy.status in [Policy.STATUS_IDLE, Policy.STATUS_ACTIVE]: | ||
user = User.objects.filter(i_user__id=policy.audit_user_id).first() | ||
# run calcrule for Invoice if there is valid rule | ||
run_calculation_rules(policy, "PolicyCreatedInvoice", user) | ||
# run calcrule for creating Bill if there is valid rule | ||
run_calculation_rules(policy, "PolicyCreated", user) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters