From 5443592d84c180e27168afb624d43e36645f42f8 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 9 Aug 2023 20:43:51 +0530 Subject: [PATCH 1/5] fix: better remarks on Cr note created by Reconciliation (cherry picked from commit 47cb349362cd6a03cd544abea5483aff23b27e7e) # Conflicts: # erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py --- .../doctype/journal_entry/journal_entry.py | 3 +++ .../payment_reconciliation.py | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 594339591f5..8c5cc2c921f 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -775,6 +775,9 @@ class JournalEntry(AccountsController): def create_remarks(self): r = [] + if self.flags.skip_remarks_creation: + return + if self.user_remark: r.append(_("Note: {0}").format(self.user_remark)) diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 216d4eccac7..cc9e2bc5a11 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -6,7 +6,7 @@ import frappe from frappe import _, msgprint, qb from frappe.model.document import Document from frappe.query_builder.custom import ConstantColumn -from frappe.utils import flt, get_link_to_form, getdate, nowdate, today +from frappe.utils import flt, fmt_money, get_link_to_form, getdate, nowdate, today import erpnext from erpnext.accounts.doctype.process_payment_reconciliation.process_payment_reconciliation import ( @@ -640,6 +640,11 @@ def reconcile_dr_cr_note(dr_cr_notes, company): "reference_type": inv.against_voucher_type, "reference_name": inv.against_voucher, "cost_center": erpnext.get_default_cost_center(company), +<<<<<<< HEAD +======= + "exchange_rate": inv.exchange_rate, + "user_remark": f"{fmt_money(flt(inv.allocated_amount), currency=company_currency)} against {inv.against_voucher}", +>>>>>>> 47cb349362 (fix: better remarks on Cr note created by Reconciliation) }, { "account": inv.account, @@ -653,6 +658,11 @@ def reconcile_dr_cr_note(dr_cr_notes, company): "reference_type": inv.voucher_type, "reference_name": inv.voucher_no, "cost_center": erpnext.get_default_cost_center(company), +<<<<<<< HEAD +======= + "exchange_rate": inv.exchange_rate, + "user_remark": f"{fmt_money(flt(inv.allocated_amount), currency=company_currency)} from {inv.voucher_no}", +>>>>>>> 47cb349362 (fix: better remarks on Cr note created by Reconciliation) }, ], } @@ -662,4 +672,10 @@ def reconcile_dr_cr_note(dr_cr_notes, company): jv.append("accounts", difference_entry) jv.flags.ignore_mandatory = True +<<<<<<< HEAD +======= + jv.flags.ignore_exchange_rate = True + jv.remark = None + jv.flags.skip_remarks_creation = True +>>>>>>> 47cb349362 (fix: better remarks on Cr note created by Reconciliation) jv.submit() From 00c7dbceaab6a676e31a0214feb4b083f249c019 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Wed, 9 Aug 2023 20:50:11 +0530 Subject: [PATCH 2/5] refactor: add `is_system_generated` field to Journal Entry (cherry picked from commit 3997aa77d40a5e9f6b6fd0554639be54bb977462) # Conflicts: # erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py --- .../doctype/journal_entry/journal_entry.json | 53 +++++-------------- .../payment_reconciliation.py | 4 ++ 2 files changed, 16 insertions(+), 41 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json index 80e72226d3d..75c32a50189 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.json +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json @@ -9,6 +9,7 @@ "engine": "InnoDB", "field_order": [ "entry_type_and_date", + "is_system_generated", "title", "voucher_type", "naming_series", @@ -88,7 +89,7 @@ "label": "Entry Type", "oldfieldname": "voucher_type", "oldfieldtype": "Select", - "options": "Journal Entry\nInter Company Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry\nDepreciation Entry\nExchange Rate Revaluation\nExchange Gain Or Loss\nDeferred Revenue\nDeferred Expense", + "options": "Journal Entry\nInter Company Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry\nDepreciation Entry\nExchange Rate Revaluation\nExchange Gain Or Loss\nDeferred Revenue\nDeferred Expense\nReversal Of ITC", "reqd": 1, "search_index": 1 }, @@ -533,57 +534,27 @@ "label": "Process Deferred Accounting", "options": "Process Deferred Accounting", "read_only": 1 + }, + { + "default": "0", + "fieldname": "is_system_generated", + "fieldtype": "Check", + "hidden": 1, + "label": "Is System Generated", + "read_only": 1 } ], "icon": "fa fa-file-text", "idx": 176, "is_submittable": 1, "links": [], - "modified": "2023-03-01 14:58:59.286591", + "modified": "2023-08-09 20:47:27.719809", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry", "naming_rule": "By \"Naming Series\" field", "owner": "Administrator", - "permissions": [ - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts User", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "import": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Accounts Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "email": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "Auditor" - } - ], + "permissions": [], "search_fields": "voucher_type,posting_date, due_date, cheque_no", "sort_field": "modified", "sort_order": "DESC", diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index cc9e2bc5a11..91c79ed1f8b 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -677,5 +677,9 @@ def reconcile_dr_cr_note(dr_cr_notes, company): jv.flags.ignore_exchange_rate = True jv.remark = None jv.flags.skip_remarks_creation = True +<<<<<<< HEAD >>>>>>> 47cb349362 (fix: better remarks on Cr note created by Reconciliation) +======= + jv.is_system_generated = True +>>>>>>> 3997aa77d4 (refactor: add `is_system_generated` field to Journal Entry) jv.submit() From 9b0d30c56b7ac2e36d63c59ce1156c35a7b2a834 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 10 Aug 2023 10:05:25 +0530 Subject: [PATCH 3/5] refactor: set flag display condition (cherry picked from commit de17eaef3857f2128303d20ec291dd7aedb61569) --- erpnext/accounts/doctype/journal_entry/journal_entry.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json index 75c32a50189..2812786381c 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.json +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json @@ -537,9 +537,9 @@ }, { "default": "0", + "depends_on": "eval:doc.is_system_generated == 1;", "fieldname": "is_system_generated", "fieldtype": "Check", - "hidden": 1, "label": "Is System Generated", "read_only": 1 } @@ -548,7 +548,7 @@ "idx": 176, "is_submittable": 1, "links": [], - "modified": "2023-08-09 20:47:27.719809", + "modified": "2023-08-10 09:54:52.060639", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry", From a04471024d79d0124dedc5dbb6b6b41a122baa91 Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Thu, 10 Aug 2023 14:32:37 +0530 Subject: [PATCH 4/5] refactor: enable 'no-copy' (cherry picked from commit 4ed4b0240d04b0bbf05afa27711d0370503380af) --- erpnext/accounts/doctype/journal_entry/journal_entry.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json index 2812786381c..80df0ff0dff 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.json +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json @@ -541,6 +541,7 @@ "fieldname": "is_system_generated", "fieldtype": "Check", "label": "Is System Generated", + "no_copy": 1, "read_only": 1 } ], @@ -548,7 +549,7 @@ "idx": 176, "is_submittable": 1, "links": [], - "modified": "2023-08-10 09:54:52.060639", + "modified": "2023-08-10 14:32:22.366895", "modified_by": "Administrator", "module": "Accounts", "name": "Journal Entry", From 727a379581caf0ef3553f095beb835df73c3ec7b Mon Sep 17 00:00:00 2001 From: ruthra kumar Date: Fri, 11 Aug 2023 09:10:10 +0530 Subject: [PATCH 5/5] chore: remove unwanted 'Reversal of ITC' and merge conflicts --- .../doctype/journal_entry/journal_entry.json | 2 +- .../payment_reconciliation.py | 15 --------------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.json b/erpnext/accounts/doctype/journal_entry/journal_entry.json index 80df0ff0dff..cff84dc9252 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.json +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.json @@ -89,7 +89,7 @@ "label": "Entry Type", "oldfieldname": "voucher_type", "oldfieldtype": "Select", - "options": "Journal Entry\nInter Company Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry\nDepreciation Entry\nExchange Rate Revaluation\nExchange Gain Or Loss\nDeferred Revenue\nDeferred Expense\nReversal Of ITC", + "options": "Journal Entry\nInter Company Journal Entry\nBank Entry\nCash Entry\nCredit Card Entry\nDebit Note\nCredit Note\nContra Entry\nExcise Entry\nWrite Off Entry\nOpening Entry\nDepreciation Entry\nExchange Rate Revaluation\nExchange Gain Or Loss\nDeferred Revenue\nDeferred Expense", "reqd": 1, "search_index": 1 }, diff --git a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py index 91c79ed1f8b..05623c09932 100644 --- a/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py +++ b/erpnext/accounts/doctype/payment_reconciliation/payment_reconciliation.py @@ -640,11 +640,7 @@ def reconcile_dr_cr_note(dr_cr_notes, company): "reference_type": inv.against_voucher_type, "reference_name": inv.against_voucher, "cost_center": erpnext.get_default_cost_center(company), -<<<<<<< HEAD -======= - "exchange_rate": inv.exchange_rate, "user_remark": f"{fmt_money(flt(inv.allocated_amount), currency=company_currency)} against {inv.against_voucher}", ->>>>>>> 47cb349362 (fix: better remarks on Cr note created by Reconciliation) }, { "account": inv.account, @@ -658,11 +654,7 @@ def reconcile_dr_cr_note(dr_cr_notes, company): "reference_type": inv.voucher_type, "reference_name": inv.voucher_no, "cost_center": erpnext.get_default_cost_center(company), -<<<<<<< HEAD -======= - "exchange_rate": inv.exchange_rate, "user_remark": f"{fmt_money(flt(inv.allocated_amount), currency=company_currency)} from {inv.voucher_no}", ->>>>>>> 47cb349362 (fix: better remarks on Cr note created by Reconciliation) }, ], } @@ -672,14 +664,7 @@ def reconcile_dr_cr_note(dr_cr_notes, company): jv.append("accounts", difference_entry) jv.flags.ignore_mandatory = True -<<<<<<< HEAD -======= - jv.flags.ignore_exchange_rate = True jv.remark = None jv.flags.skip_remarks_creation = True -<<<<<<< HEAD ->>>>>>> 47cb349362 (fix: better remarks on Cr note created by Reconciliation) -======= jv.is_system_generated = True ->>>>>>> 3997aa77d4 (refactor: add `is_system_generated` field to Journal Entry) jv.submit()