Skip to content

Commit

Permalink
fix unit test error in contract (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
delcroip authored Mar 8, 2024
1 parent 7c0d5a6 commit 5134f9f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions calcrule_social_protection/calculation_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from core.abs_calculation_rule import AbsCalculationRule
from core.signals import *
from core import datetime

from contribution_plan.models import PaymentPlan

class SocialProtectionCalculationRule(AbsCalculationRule):
version = 1
Expand Down Expand Up @@ -44,8 +44,11 @@ def ready(cls):
cls.signal_convert_from_to.connect(cls.run_convert, dispatch_uid="on_convert_from_to")

@classmethod
def run_calculation_rules(cls, sender, payment_plan, user, context, **kwargs):
return cls.calculate_if_active_for_object(payment_plan, **kwargs)
def run_calculation_rules(cls, sender, instance, user, context, **kwargs):
if isinstance(instance, PaymentPlan):
return cls.calculate_if_active_for_object(instance, **kwargs)
else:
return False

@classmethod
def calculate_if_active_for_object(cls, payment_plan, **kwargs):
Expand Down

0 comments on commit 5134f9f

Please sign in to comment.