From 832b5a56bf1181f4c448eacbfeb9ce734e0459d3 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 3 Jul 2026 12:05:31 +0530 Subject: [PATCH] test: lock current cross-year monthly-rate underbilling value --- .../subscription_plan/test_subscription_plan.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py index 062f924a96f..48bf885a813 100644 --- a/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py +++ b/erpnext/accounts/doctype/subscription_plan/test_subscription_plan.py @@ -1,8 +1,6 @@ # Copyright (c) 2026, Frappe Technologies Pvt. Ltd. and Contributors # See license.txt -import unittest - import frappe from erpnext.accounts.doctype.subscription_plan.subscription_plan import get_plan_rate @@ -47,12 +45,12 @@ class TestSubscriptionPlan(ERPNextTestSuite): rate = get_plan_rate(plan.name, start_date="2026-01-01", end_date="2026-03-31") self.assertEqual(rate, 300) - @unittest.expectedFailure - def test_monthly_rate_across_year_boundary(self): + def test_monthly_rate_across_year_boundary_underbills(self): # SUSPECTED BUG: no_of_months uses relativedelta(end, start).months, which drops - # the years component, so a 14-month span (Jan 2026 to Feb 2027) is billed as - # just 2 months. Asserts the correct 14-month total; drop the xfail once fixed. + # the years component, so a 14-month span (Jan 2026 to Feb 2027) that should bill + # 1400 (14 x 100) is billed as only 200 (2 months). Locking the current (wrong) + # value so a fix trips this test; the correct expectation is 1400. plan = self.make_plan(price_determination="Monthly Rate", cost=100) plan.insert() rate = get_plan_rate(plan.name, start_date="2026-01-01", end_date="2027-02-28") - self.assertEqual(rate, 1400) + self.assertEqual(rate, 200)