From d512919f5c95605e98495d5b2f1b11f838622b79 Mon Sep 17 00:00:00 2001 From: artykbasar <78363421+artykbasar@users.noreply.github.com> Date: Sun, 11 Dec 2022 08:51:34 +0000 Subject: [PATCH] Subscription Cost center value is fixed to Default value(Bug fix) self.cost_center field value keeps changing to erpnext.get_default_cost_center(self.get("company")) after validation of this doctype. This overrides the user input. simple fix, it will first check if the field is empty, if empty then puts the company's default cost center value if not then user input will be saved. --- erpnext/accounts/doctype/subscription/subscription.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/subscription/subscription.py b/erpnext/accounts/doctype/subscription/subscription.py index 9dab4e91fb..8708342b11 100644 --- a/erpnext/accounts/doctype/subscription/subscription.py +++ b/erpnext/accounts/doctype/subscription/subscription.py @@ -280,7 +280,8 @@ class Subscription(Document): self.validate_plans_billing_cycle(self.get_billing_cycle_and_interval()) self.validate_end_date() self.validate_to_follow_calendar_months() - self.cost_center = erpnext.get_default_cost_center(self.get("company")) + if not self.cost_center: + self.cost_center = erpnext.get_default_cost_center(self.get("company")) def validate_trial_period(self): """