From 1efb31724326a8778af8d3620d39c4e1defccf35 Mon Sep 17 00:00:00 2001 From: Anupam Date: Mon, 28 Mar 2022 14:36:43 +0530 Subject: [PATCH 01/10] feat: configurable Contract naming --- erpnext/crm/doctype/contract/contract.js | 11 ++++++++++ erpnext/crm/doctype/contract/contract.json | 13 +++++++++++- erpnext/crm/doctype/contract/contract.py | 21 ++++++++++++------- .../selling_settings/selling_settings.json | 12 ++++++++--- 4 files changed, 45 insertions(+), 12 deletions(-) diff --git a/erpnext/crm/doctype/contract/contract.js b/erpnext/crm/doctype/contract/contract.js index 7848de7a727..8751edbc9b2 100644 --- a/erpnext/crm/doctype/contract/contract.js +++ b/erpnext/crm/doctype/contract/contract.js @@ -2,6 +2,17 @@ // For license information, please see license.txt frappe.ui.form.on("Contract", { + onload: function(frm) { + frappe.db.get_value( + "Selling Settings", + "Selling Settings", + "contract_naming_by", + (r) => { + frm.toggle_display("naming_series", r.contract_naming_by === "Naming Series"); + } + ); + }, + contract_template: function (frm) { if (frm.doc.contract_template) { frappe.call({ diff --git a/erpnext/crm/doctype/contract/contract.json b/erpnext/crm/doctype/contract/contract.json index de3230f0e67..8a65ca5f20d 100755 --- a/erpnext/crm/doctype/contract/contract.json +++ b/erpnext/crm/doctype/contract/contract.json @@ -2,11 +2,13 @@ "actions": [], "allow_import": 1, "allow_rename": 1, + "autoname": "naming_series:", "creation": "2018-04-12 06:32:04.582486", "doctype": "DocType", "editable_grid": 1, "engine": "InnoDB", "field_order": [ + "naming_series", "party_type", "is_signed", "cb_party", @@ -244,11 +246,20 @@ "fieldname": "authorised_by_section", "fieldtype": "Section Break", "label": "Authorised By" + }, + { + "fieldname": "naming_series", + "fieldtype": "Select", + "label": "Naming Series", + "no_copy": 1, + "options": "CRM-CONTR-.YYYY.-", + "reqd": 1, + "set_only_once": 1 } ], "is_submittable": 1, "links": [], - "modified": "2020-12-07 11:15:58.385521", + "modified": "2022-03-28 10:22:11.156658", "modified_by": "Administrator", "module": "CRM", "name": "Contract", diff --git a/erpnext/crm/doctype/contract/contract.py b/erpnext/crm/doctype/contract/contract.py index e21f46a3837..86eaf07f1b5 100644 --- a/erpnext/crm/doctype/contract/contract.py +++ b/erpnext/crm/doctype/contract/contract.py @@ -5,22 +5,27 @@ import frappe from frappe import _ from frappe.model.document import Document +from frappe.model.naming import set_name_by_naming_series from frappe.utils import getdate, nowdate class Contract(Document): def autoname(self): - name = self.party_name + if frappe.db.get_single_value("Selling Settings", "contract_naming_by") == "Naming Series": + set_name_by_naming_series(self) - if self.contract_template: - name += " - {} Agreement".format(self.contract_template) + else: + name = self.party_name - # If identical, append contract name with the next number in the iteration - if frappe.db.exists("Contract", name): - count = len(frappe.get_all("Contract", filters={"name": ["like", "%{}%".format(name)]})) - name = "{} - {}".format(name, count) + if self.contract_template: + name += " - {} Agreement".format(self.contract_template) - self.name = _(name) + # If identical, append contract name with the next number in the iteration + if frappe.db.exists("Contract", name): + count = len(frappe.get_all("Contract", filters={"name": ["like", "%{}%".format(name)]})) + name = "{} - {}".format(name, count) + + self.name = _(name) def validate(self): self.validate_dates() diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json index a0c1c85dd52..eabfd7d2e22 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.json +++ b/erpnext/selling/doctype/selling_settings/selling_settings.json @@ -13,6 +13,7 @@ "territory", "crm_settings_section", "campaign_naming_by", + "contract_naming_by", "default_valid_till", "column_break_9", "close_opportunity_after_days", @@ -29,7 +30,6 @@ "so_required", "dn_required", "sales_update_frequency", - "column_break_5", "allow_multiple_items", "allow_against_multiple_purchase_orders", "hide_tax_id" @@ -193,6 +193,12 @@ "fieldname": "sales_transactions_settings_section", "fieldtype": "Section Break", "label": "Transaction Settings" + }, + { + "fieldname": "contract_naming_by", + "fieldtype": "Select", + "label": "Contract Naming By", + "options": "Party Name\nNaming Series" } ], "icon": "fa fa-cog", @@ -200,7 +206,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2021-09-14 22:05:06.139820", + "modified": "2022-03-28 12:18:06.768403", "modified_by": "Administrator", "module": "Selling", "name": "Selling Settings", @@ -219,4 +225,4 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1 -} +} \ No newline at end of file From 20ef6ab5bf56827975778d28110998deb35c5f77 Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 31 Mar 2022 12:04:53 +0530 Subject: [PATCH 02/10] fix: review changes --- erpnext/crm/doctype/contract/contract.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/erpnext/crm/doctype/contract/contract.py b/erpnext/crm/doctype/contract/contract.py index 86eaf07f1b5..f186e87813e 100644 --- a/erpnext/crm/doctype/contract/contract.py +++ b/erpnext/crm/doctype/contract/contract.py @@ -18,12 +18,14 @@ class Contract(Document): name = self.party_name if self.contract_template: - name += " - {} Agreement".format(self.contract_template) + name = f"{name} - {self.contract_template} Agreement" # If identical, append contract name with the next number in the iteration if frappe.db.exists("Contract", name): - count = len(frappe.get_all("Contract", filters={"name": ["like", "%{}%".format(name)]})) - name = "{} - {}".format(name, count) + count = frappe.db.count('Contract', filters={ + 'name': ('like', f"%{name}%"), + }) + name = f"{name} - {count}" self.name = _(name) From 444625a0ca387a4752b867070e7a77c0a40bd863 Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 31 Mar 2022 13:38:37 +0530 Subject: [PATCH 03/10] fix: linter issues --- erpnext/crm/doctype/contract/contract.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/erpnext/crm/doctype/contract/contract.py b/erpnext/crm/doctype/contract/contract.py index f186e87813e..dd4b86dd8b6 100644 --- a/erpnext/crm/doctype/contract/contract.py +++ b/erpnext/crm/doctype/contract/contract.py @@ -22,9 +22,12 @@ class Contract(Document): # If identical, append contract name with the next number in the iteration if frappe.db.exists("Contract", name): - count = frappe.db.count('Contract', filters={ - 'name': ('like', f"%{name}%"), - }) + count = frappe.db.count( + "Contract", + filters={ + "name": ("like", f"%{name}%"), + }, + ) name = f"{name} - {count}" self.name = _(name) From a35cc7004d565d29c6e983b9d9b09720dd8be7b3 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 1 Apr 2022 14:17:25 +0530 Subject: [PATCH 04/10] fix: convert dates to datetime before comparing in leave days calculation and fix half day edge case (backport #30538) (#30541) --- .../leave_application/leave_application.py | 4 ++-- .../test_leave_application.py | 20 ++++++++++++++++--- .../doctype/salary_slip/test_salary_slip.py | 13 +++++++++++- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/erpnext/hr/doctype/leave_application/leave_application.py b/erpnext/hr/doctype/leave_application/leave_application.py index 9036727f76f..e6fc2e6fc06 100755 --- a/erpnext/hr/doctype/leave_application/leave_application.py +++ b/erpnext/hr/doctype/leave_application/leave_application.py @@ -735,9 +735,9 @@ def get_number_of_leave_days( (Based on the include_holiday setting in Leave Type)""" number_of_days = 0 if cint(half_day) == 1: - if from_date == to_date: + if getdate(from_date) == getdate(to_date): number_of_days = 0.5 - elif half_day_date and half_day_date <= to_date: + elif half_day_date and getdate(from_date) <= getdate(half_day_date) <= getdate(to_date): number_of_days = date_diff(to_date, from_date) + 0.5 else: number_of_days = date_diff(to_date, from_date) + 1 diff --git a/erpnext/hr/doctype/leave_application/test_leave_application.py b/erpnext/hr/doctype/leave_application/test_leave_application.py index dc8187cf5b7..8924a57708e 100644 --- a/erpnext/hr/doctype/leave_application/test_leave_application.py +++ b/erpnext/hr/doctype/leave_application/test_leave_application.py @@ -205,7 +205,12 @@ class TestLeaveApplication(unittest.TestCase): # creates separate leave ledger entries frappe.delete_doc_if_exists("Leave Type", "Test Leave Validation", force=1) leave_type = frappe.get_doc( - dict(leave_type_name="Test Leave Validation", doctype="Leave Type", allow_negative=True) + dict( + leave_type_name="Test Leave Validation", + doctype="Leave Type", + allow_negative=True, + include_holiday=True, + ) ).insert() employee = get_employee() @@ -217,8 +222,14 @@ class TestLeaveApplication(unittest.TestCase): # application across allocations # CASE 1: from date has no allocation, to date has an allocation / both dates have allocation + start_date = add_days(year_start, -10) application = make_leave_application( - employee.name, add_days(year_start, -10), add_days(year_start, 3), leave_type.name + employee.name, + start_date, + add_days(year_start, 3), + leave_type.name, + half_day=1, + half_day_date=start_date, ) # 2 separate leave ledger entries @@ -827,6 +838,7 @@ class TestLeaveApplication(unittest.TestCase): leave_type_name="_Test_CF_leave_expiry", is_carry_forward=1, expire_carry_forwarded_leaves_after_days=90, + include_holiday=True, ) leave_type.submit() @@ -839,6 +851,8 @@ class TestLeaveApplication(unittest.TestCase): leave_type=leave_type.name, from_date=add_days(nowdate(), -3), to_date=add_days(nowdate(), 7), + half_day=1, + half_day_date=add_days(nowdate(), -3), description="_Test Reason", company="_Test Company", docstatus=1, @@ -854,7 +868,7 @@ class TestLeaveApplication(unittest.TestCase): self.assertEqual(len(leave_ledger_entry), 2) self.assertEqual(leave_ledger_entry[0].employee, leave_application.employee) self.assertEqual(leave_ledger_entry[0].leave_type, leave_application.leave_type) - self.assertEqual(leave_ledger_entry[0].leaves, -9) + self.assertEqual(leave_ledger_entry[0].leaves, -8.5) self.assertEqual(leave_ledger_entry[1].leaves, -2) def test_leave_application_creation_after_expiry(self): diff --git a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py index 2a68d9b979a..65dae625b6e 100644 --- a/erpnext/payroll/doctype/salary_slip/test_salary_slip.py +++ b/erpnext/payroll/doctype/salary_slip/test_salary_slip.py @@ -1294,7 +1294,16 @@ def create_additional_salary(employee, payroll_period, amount): return salary_date -def make_leave_application(employee, from_date, to_date, leave_type, company=None, submit=True): +def make_leave_application( + employee, + from_date, + to_date, + leave_type, + company=None, + half_day=False, + half_day_date=None, + submit=True, +): leave_application = frappe.get_doc( dict( doctype="Leave Application", @@ -1302,6 +1311,8 @@ def make_leave_application(employee, from_date, to_date, leave_type, company=Non leave_type=leave_type, from_date=from_date, to_date=to_date, + half_day=half_day, + half_day_date=half_day_date, company=company or erpnext.get_default_company() or "_Test Company", status="Approved", leave_approver="test@example.com", From 63dacaa03d5f64889b76e02e946b7d7fe094c049 Mon Sep 17 00:00:00 2001 From: Alberto826 <46285948+Alberto826@users.noreply.github.com> Date: Fri, 1 Apr 2022 11:18:15 +0200 Subject: [PATCH 05/10] fix: Remove trailing slashes "/" from route (#30531) Trailing slashes "/" in the routes causes redirect to port 8080 in docker implementation with reverse proxy. The "student_admission_row.html" template has an href attribute with a trailing slash. --- .../student_admission/templates/student_admission_row.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/education/doctype/student_admission/templates/student_admission_row.html b/erpnext/education/doctype/student_admission/templates/student_admission_row.html index 529d65184a8..dc4587bc940 100644 --- a/erpnext/education/doctype/student_admission/templates/student_admission_row.html +++ b/erpnext/education/doctype/student_admission/templates/student_admission_row.html @@ -1,6 +1,6 @@
{% set today = frappe.utils.getdate(frappe.utils.nowdate()) %} - +
Date: Fri, 1 Apr 2022 15:50:04 +0530 Subject: [PATCH 06/10] perf: index barcode for faster scans (#30543) (#30544) (cherry picked from commit 6c5b01c60df4c125a3f3b220c351b35b924703df) Co-authored-by: Ankush Menat --- .../doctype/item_barcode/item_barcode.json | 137 +++++------------- 1 file changed, 35 insertions(+), 102 deletions(-) diff --git a/erpnext/stock/doctype/item_barcode/item_barcode.json b/erpnext/stock/doctype/item_barcode/item_barcode.json index d89ca55a4f3..eef70c95d05 100644 --- a/erpnext/stock/doctype/item_barcode/item_barcode.json +++ b/erpnext/stock/doctype/item_barcode/item_barcode.json @@ -1,109 +1,42 @@ { - "allow_copy": 0, - "allow_events_in_timeline": 0, - "allow_guest_to_view": 0, - "allow_import": 0, - "allow_rename": 0, - "autoname": "field:barcode", - "beta": 0, - "creation": "2017-12-09 18:54:50.562438", - "custom": 0, - "docstatus": 0, - "doctype": "DocType", - "document_type": "", - "editable_grid": 1, - "engine": "InnoDB", + "actions": [], + "autoname": "hash", + "creation": "2022-02-11 11:26:22.155183", + "doctype": "DocType", + "engine": "InnoDB", + "field_order": [ + "barcode", + "barcode_type" + ], "fields": [ { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "barcode", - "fieldtype": "Data", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 1, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Barcode", - "length": 0, - "no_copy": 1, - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, + "fieldname": "barcode", + "fieldtype": "Data", + "in_global_search": 1, + "in_list_view": 1, + "label": "Barcode", + "no_copy": 1, "unique": 1 - }, + }, { - "allow_bulk_edit": 0, - "allow_in_quick_entry": 0, - "allow_on_submit": 0, - "bold": 0, - "collapsible": 0, - "columns": 0, - "fieldname": "barcode_type", - "fieldtype": "Select", - "hidden": 0, - "ignore_user_permissions": 0, - "ignore_xss_filter": 0, - "in_filter": 0, - "in_global_search": 0, - "in_list_view": 1, - "in_standard_filter": 0, - "label": "Barcode Type", - "length": 0, - "no_copy": 0, - "options": "\nEAN\nUPC-A", - "permlevel": 0, - "precision": "", - "print_hide": 0, - "print_hide_if_no_value": 0, - "read_only": 0, - "remember_last_selected_value": 0, - "report_hide": 0, - "reqd": 0, - "search_index": 0, - "set_only_once": 0, - "translatable": 0, - "unique": 0 + "fieldname": "barcode_type", + "fieldtype": "Select", + "in_list_view": 1, + "label": "Barcode Type", + "options": "\nEAN\nUPC-A" } - ], - "has_web_view": 0, - "hide_heading": 0, - "hide_toolbar": 0, - "idx": 0, - "image_view": 0, - "in_create": 0, - "is_submittable": 0, - "issingle": 0, - "istable": 1, - "max_attachments": 0, - "modified": "2018-11-13 06:03:09.814357", - "modified_by": "Administrator", - "module": "Stock", - "name": "Item Barcode", - "name_case": "", - "owner": "Administrator", - "permissions": [], - "quick_entry": 1, - "read_only": 0, - "read_only_onload": 0, - "show_name_in_global_search": 0, - "sort_field": "modified", - "sort_order": "DESC", - "track_changes": 1, - "track_seen": 0, - "track_views": 0 + ], + "istable": 1, + "links": [], + "modified": "2022-04-01 05:54:27.314030", + "modified_by": "Administrator", + "module": "Stock", + "name": "Item Barcode", + "naming_rule": "Random", + "owner": "Administrator", + "permissions": [], + "sort_field": "modified", + "sort_order": "DESC", + "states": [], + "track_changes": 1 } \ No newline at end of file From c44a4e559bc05c2d21614c9ce856c0472081e040 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Fri, 11 Mar 2022 16:44:21 +0530 Subject: [PATCH 07/10] fix: incorrect payable amount for loan closure - Add penalty amount to payable amount for loan closure (cherry picked from commit 4e92926a525b396173dbc4d6dd476b2ab4874f9b) # Conflicts: # erpnext/loan_management/doctype/loan_repayment/loan_repayment.py --- .../doctype/loan_repayment/loan_repayment.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py index ce50dd3b38d..2362d80223b 100644 --- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py +++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py @@ -743,9 +743,17 @@ def calculate_amounts(against_loan, posting_date, payment_type=""): amounts = get_amounts(amounts, against_loan, posting_date) # update values for closure +<<<<<<< HEAD if payment_type == "Loan Closure": amounts["payable_principal_amount"] = amounts["pending_principal_amount"] amounts["interest_amount"] += amounts["unaccrued_interest"] amounts["payable_amount"] = amounts["payable_principal_amount"] + amounts["interest_amount"] +======= + if payment_type == 'Loan Closure': + amounts['payable_principal_amount'] = amounts['pending_principal_amount'] + amounts['interest_amount'] += amounts['unaccrued_interest'] + amounts['payable_amount'] = amounts['payable_principal_amount'] + amounts['interest_amount'] + amounts['payable_amount'] = amounts['penalty_amount'] +>>>>>>> 4e92926a52 (fix: incorrect payable amount for loan closure) return amounts From 1d9a6efb1baf74fb3f8f01a69bbd15a13692a3a5 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Fri, 11 Mar 2022 16:46:30 +0530 Subject: [PATCH 08/10] fix: incorrect payable amount for loan closure (cherry picked from commit 8c76a76154d8976760d19d95f421dd2b0ee238bf) # Conflicts: # erpnext/loan_management/doctype/loan_repayment/loan_repayment.py --- .../loan_management/doctype/loan_repayment/loan_repayment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py index 2362d80223b..d0559a51847 100644 --- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py +++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py @@ -753,7 +753,11 @@ def calculate_amounts(against_loan, posting_date, payment_type=""): amounts['payable_principal_amount'] = amounts['pending_principal_amount'] amounts['interest_amount'] += amounts['unaccrued_interest'] amounts['payable_amount'] = amounts['payable_principal_amount'] + amounts['interest_amount'] +<<<<<<< HEAD amounts['payable_amount'] = amounts['penalty_amount'] >>>>>>> 4e92926a52 (fix: incorrect payable amount for loan closure) +======= + amounts['payable_amount'] += amounts['penalty_amount'] +>>>>>>> 8c76a76154 (fix: incorrect payable amount for loan closure) return amounts From 3fc43cb259b912743c7e35df9e24e7861e07845d Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 21 Mar 2022 17:06:23 +0530 Subject: [PATCH 09/10] fix: Code cleanup (cherry picked from commit 1b2c6a5b78d4ee2e31817eb78bb1f614b672eda4) # Conflicts: # erpnext/loan_management/doctype/loan_repayment/loan_repayment.py --- .../loan_management/doctype/loan_repayment/loan_repayment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py index d0559a51847..8468b236dba 100644 --- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py +++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py @@ -752,6 +752,7 @@ def calculate_amounts(against_loan, posting_date, payment_type=""): if payment_type == 'Loan Closure': amounts['payable_principal_amount'] = amounts['pending_principal_amount'] amounts['interest_amount'] += amounts['unaccrued_interest'] +<<<<<<< HEAD amounts['payable_amount'] = amounts['payable_principal_amount'] + amounts['interest_amount'] <<<<<<< HEAD amounts['payable_amount'] = amounts['penalty_amount'] @@ -759,5 +760,8 @@ def calculate_amounts(against_loan, posting_date, payment_type=""): ======= amounts['payable_amount'] += amounts['penalty_amount'] >>>>>>> 8c76a76154 (fix: incorrect payable amount for loan closure) +======= + amounts['payable_amount'] = amounts['payable_principal_amount'] + amounts['interest_amount'] + amounts['penalty_amount'] +>>>>>>> 1b2c6a5b78 (fix: Code cleanup) return amounts From 7bf6de18834b2749187979911115c4eeae957612 Mon Sep 17 00:00:00 2001 From: Deepesh Garg Date: Sat, 2 Apr 2022 20:33:46 +0530 Subject: [PATCH 10/10] fix: Resolve conflicts --- .../doctype/loan_repayment/loan_repayment.py | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py index 8468b236dba..6159275c5d1 100644 --- a/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py +++ b/erpnext/loan_management/doctype/loan_repayment/loan_repayment.py @@ -743,25 +743,12 @@ def calculate_amounts(against_loan, posting_date, payment_type=""): amounts = get_amounts(amounts, against_loan, posting_date) # update values for closure -<<<<<<< HEAD if payment_type == "Loan Closure": amounts["payable_principal_amount"] = amounts["pending_principal_amount"] amounts["interest_amount"] += amounts["unaccrued_interest"] amounts["payable_amount"] = amounts["payable_principal_amount"] + amounts["interest_amount"] -======= - if payment_type == 'Loan Closure': - amounts['payable_principal_amount'] = amounts['pending_principal_amount'] - amounts['interest_amount'] += amounts['unaccrued_interest'] -<<<<<<< HEAD - amounts['payable_amount'] = amounts['payable_principal_amount'] + amounts['interest_amount'] -<<<<<<< HEAD - amounts['payable_amount'] = amounts['penalty_amount'] ->>>>>>> 4e92926a52 (fix: incorrect payable amount for loan closure) -======= - amounts['payable_amount'] += amounts['penalty_amount'] ->>>>>>> 8c76a76154 (fix: incorrect payable amount for loan closure) -======= - amounts['payable_amount'] = amounts['payable_principal_amount'] + amounts['interest_amount'] + amounts['penalty_amount'] ->>>>>>> 1b2c6a5b78 (fix: Code cleanup) + amounts["payable_amount"] = ( + amounts["payable_principal_amount"] + amounts["interest_amount"] + amounts["penalty_amount"] + ) return amounts