Skip to content

Commit

Permalink
fix: number of months subscription plan
Browse files Browse the repository at this point in the history
(cherry picked from commit 2d30b36)
  • Loading branch information
codezart authored and mergify[bot] committed Oct 20, 2022
1 parent dbbebd2 commit fff9e76
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -8,6 +8,7 @@
from frappe.utils import date_diff, flt, get_first_day, get_last_day, getdate

from erpnext.utilities.product import get_price
from dateutil import relativedelta


class SubscriptionPlan(Document):
Expand Down Expand Up @@ -49,7 +50,7 @@ def get_plan_rate(
start_date = getdate(start_date)
end_date = getdate(end_date)

no_of_months = (end_date.year - start_date.year) * 12 + (end_date.month - start_date.month) + 1
no_of_months = relativedelta.relativedelta(end_date, start_date).months + 1
cost = plan.cost * no_of_months

# Adjust cost if start or end date is not month start or end
Expand Down

0 comments on commit fff9e76

Please sign in to comment.