diff --git a/erpnext/loan_management/doctype/loan/loan.py b/erpnext/loan_management/doctype/loan/loan.py index 69e9ef8ebc3..ff940545a1b 100644 --- a/erpnext/loan_management/doctype/loan/loan.py +++ b/erpnext/loan_management/doctype/loan/loan.py @@ -61,11 +61,11 @@ class Loan(AccountsController): ) def validate_cost_center(self): - if not self.cost_center and self.rate_of_interest != 0: - self.cost_center = frappe.db.get_value('Company', self.company, 'cost_center') + if not self.cost_center and self.rate_of_interest != 0.0: + self.cost_center = frappe.db.get_value("Company", self.company, "cost_center") - if not self.cost_center: - frappe.throw(_('Cost center is mandatory for loans having rate of interest greater than 0')) + if not self.cost_center: + frappe.throw(_("Cost center is mandatory for loans having rate of interest greater than 0")) def on_submit(self): self.link_loan_security_pledge() diff --git a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py index 20eb637faac..3a4c6513e45 100644 --- a/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py +++ b/erpnext/loan_management/doctype/loan_interest_accrual/loan_interest_accrual.py @@ -40,11 +40,10 @@ class LoanInterestAccrual(AccountsController): def make_gl_entries(self, cancel=0, adv_adj=0): gle_map = [] - cost_center = frappe.db.get_value('Loan', self.loan, 'cost_center') + cost_center = frappe.db.get_value("Loan", self.loan, "cost_center") if self.interest_amount: gle_map.append( -<<<<<<< HEAD self.get_gl_dict( { "account": self.loan_account, @@ -58,7 +57,7 @@ class LoanInterestAccrual(AccountsController): "remarks": _("Interest accrued from {0} to {1} against loan: {2}").format( self.last_accrual_date, self.posting_date, self.loan ), - "cost_center": erpnext.get_default_cost_center(self.company), + "cost_center": cost_center, "posting_date": self.posting_date, } ) @@ -76,41 +75,10 @@ class LoanInterestAccrual(AccountsController): "remarks": ("Interest accrued from {0} to {1} against loan: {2}").format( self.last_accrual_date, self.posting_date, self.loan ), - "cost_center": erpnext.get_default_cost_center(self.company), + "cost_center": cost_center, "posting_date": self.posting_date, } ) -======= - self.get_gl_dict({ - "account": self.loan_account, - "party_type": self.applicant_type, - "party": self.applicant, - "against": self.interest_income_account, - "debit": self.interest_amount, - "debit_in_account_currency": self.interest_amount, - "against_voucher_type": "Loan", - "against_voucher": self.loan, - "remarks": _("Interest accrued from {0} to {1} against loan: {2}").format( - self.last_accrual_date, self.posting_date, self.loan), - "cost_center": cost_center, - "posting_date": self.posting_date - }) - ) - - gle_map.append( - self.get_gl_dict({ - "account": self.interest_income_account, - "against": self.loan_account, - "credit": self.interest_amount, - "credit_in_account_currency": self.interest_amount, - "against_voucher_type": "Loan", - "against_voucher": self.loan, - "remarks": ("Interest accrued from {0} to {1} against loan: {2}").format( - self.last_accrual_date, self.posting_date, self.loan), - "cost_center": cost_center, - "posting_date": self.posting_date - }) ->>>>>>> 5d66cc4c4a (fix: Add cost center in loan document) ) if gle_map: diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a1e2104f081..f639dc7d380 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -352,7 +352,6 @@ erpnext.patches.v13_0.amazon_mws_deprecation_warning erpnext.patches.v13_0.datev_deprecation_warning erpnext.patches.v13_0.set_work_order_qty_in_so_from_mr erpnext.patches.v13_0.update_accounts_in_loan_docs -<<<<<<< HEAD erpnext.patches.v13_0.remove_unknown_links_to_prod_plan_items # 24-03-2022 erpnext.patches.v13_0.rename_non_profit_fields erpnext.patches.v13_0.enable_ksa_vat_docs #1 @@ -368,9 +367,4 @@ erpnext.patches.v13_0.create_accounting_dimensions_in_orders erpnext.patches.v13_0.set_per_billed_in_return_delivery_note erpnext.patches.v13_0.update_employee_advance_status erpnext.patches.v13_0.job_card_status_on_hold -======= -erpnext.patches.v14_0.update_batch_valuation_flag -erpnext.patches.v14_0.delete_non_profit_doctypes -erpnext.patches.v14_0.update_employee_advance_status erpnext.patches.v13_0.add_cost_center_in_loans ->>>>>>> 5d66cc4c4a (fix: Add cost center in loan document)