mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-05 13:24:47 +00:00
Merge pull request #32673 from frappe/mergify/bp/version-14-hotfix/pr-32551
fix: number of months subscription plan (backport #32551)
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
|
from dateutil import relativedelta
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
from frappe.utils import date_diff, flt, get_first_day, get_last_day, getdate
|
from frappe.utils import date_diff, flt, get_first_day, get_last_day, getdate
|
||||||
@@ -49,7 +50,7 @@ def get_plan_rate(
|
|||||||
start_date = getdate(start_date)
|
start_date = getdate(start_date)
|
||||||
end_date = getdate(end_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
|
cost = plan.cost * no_of_months
|
||||||
|
|
||||||
# Adjust cost if start or end date is not month start or end
|
# Adjust cost if start or end date is not month start or end
|
||||||
|
|||||||
Reference in New Issue
Block a user