mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-27 02:28:30 +00:00
feat: use single remark field with custom remark toggle
(cherry picked from commit 697f521e14)
# Conflicts:
# erpnext/accounts/doctype/journal_entry/journal_entry.json
This commit is contained in:
@@ -648,7 +648,7 @@ $.extend(erpnext.journal_entry, {
|
|||||||
reqd: 1,
|
reqd: 1,
|
||||||
default: frm.doc.posting_date,
|
default: frm.doc.posting_date,
|
||||||
},
|
},
|
||||||
{ fieldtype: "Small Text", fieldname: "user_remark", label: __("User Remark") },
|
{ fieldtype: "Small Text", fieldname: "remark", label: __("Remark") },
|
||||||
{
|
{
|
||||||
fieldtype: "Select",
|
fieldtype: "Select",
|
||||||
fieldname: "naming_series",
|
fieldname: "naming_series",
|
||||||
@@ -665,8 +665,11 @@ $.extend(erpnext.journal_entry, {
|
|||||||
var values = dialog.get_values();
|
var values = dialog.get_values();
|
||||||
|
|
||||||
frm.set_value("posting_date", values.posting_date);
|
frm.set_value("posting_date", values.posting_date);
|
||||||
frm.set_value("user_remark", values.user_remark);
|
|
||||||
frm.set_value("naming_series", values.naming_series);
|
frm.set_value("naming_series", values.naming_series);
|
||||||
|
if (values.remark) {
|
||||||
|
frm.set_value("custom_remark", 1);
|
||||||
|
frm.set_value("remark", values.remark);
|
||||||
|
}
|
||||||
|
|
||||||
// clear table is used because there might've been an error while adding child
|
// clear table is used because there might've been an error while adding child
|
||||||
// and cleanup didn't happen
|
// and cleanup didn't happen
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
"from_template",
|
"from_template",
|
||||||
"title",
|
"title",
|
||||||
"column_break3",
|
"column_break3",
|
||||||
|
"custom_remark",
|
||||||
"remark",
|
"remark",
|
||||||
"mode_of_payment",
|
"mode_of_payment",
|
||||||
"party_not_required"
|
"party_not_required"
|
||||||
@@ -202,6 +203,7 @@
|
|||||||
{
|
{
|
||||||
"fieldname": "user_remark",
|
"fieldname": "user_remark",
|
||||||
"fieldtype": "Small Text",
|
"fieldtype": "Small Text",
|
||||||
|
"hidden": 1,
|
||||||
"label": "User Remark",
|
"label": "User Remark",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "user_remark",
|
"oldfieldname": "user_remark",
|
||||||
@@ -315,7 +317,7 @@
|
|||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"oldfieldname": "remark",
|
"oldfieldname": "remark",
|
||||||
"oldfieldtype": "Small Text",
|
"oldfieldtype": "Small Text",
|
||||||
"read_only": 1
|
"read_only_depends_on": "eval: !doc.custom_remark"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"depends_on": "eval:doc.voucher_type== \"Inter Company Journal Entry\"",
|
"depends_on": "eval:doc.voucher_type== \"Inter Company Journal Entry\"",
|
||||||
@@ -651,6 +653,20 @@
|
|||||||
"fieldname": "tax_withholding_tab",
|
"fieldname": "tax_withholding_tab",
|
||||||
"fieldtype": "Tab Break",
|
"fieldtype": "Tab Break",
|
||||||
"label": "Tax Withholding"
|
"label": "Tax Withholding"
|
||||||
|
<<<<<<< HEAD
|
||||||
|
=======
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "auto_repeat_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "Auto Repeat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "custom_remark",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Custom Remark"
|
||||||
|
>>>>>>> 697f521e14 (feat: use single remark field with custom remark toggle)
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"icon": "fa fa-file-text",
|
"icon": "fa fa-file-text",
|
||||||
@@ -665,7 +681,7 @@
|
|||||||
"table_fieldname": "payment_entries"
|
"table_fieldname": "payment_entries"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2026-03-09 17:15:26.569327",
|
"modified": "2026-04-08 14:19:30.870894",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Journal Entry",
|
"name": "Journal Entry",
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ class JournalEntry(AccountsController):
|
|||||||
cheque_no: DF.Data | None
|
cheque_no: DF.Data | None
|
||||||
clearance_date: DF.Date | None
|
clearance_date: DF.Date | None
|
||||||
company: DF.Link
|
company: DF.Link
|
||||||
|
custom_remark: DF.Check
|
||||||
difference: DF.Currency
|
difference: DF.Currency
|
||||||
due_date: DF.Date | None
|
due_date: DF.Date | None
|
||||||
finance_book: DF.Link | None
|
finance_book: DF.Link | None
|
||||||
@@ -1023,11 +1024,11 @@ class JournalEntry(AccountsController):
|
|||||||
def create_remarks(self):
|
def create_remarks(self):
|
||||||
r = []
|
r = []
|
||||||
|
|
||||||
if self.flags.skip_remarks_creation:
|
if self.get("custom_remark"):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.user_remark:
|
if self.flags.skip_remarks_creation:
|
||||||
r.append(_("Note: {0}").format(self.user_remark))
|
return
|
||||||
|
|
||||||
if self.cheque_no:
|
if self.cheque_no:
|
||||||
if self.cheque_date:
|
if self.cheque_date:
|
||||||
@@ -1135,9 +1136,7 @@ class JournalEntry(AccountsController):
|
|||||||
|
|
||||||
for d in self.get("accounts"):
|
for d in self.get("accounts"):
|
||||||
if d.debit or d.credit or (self.voucher_type == "Exchange Gain Or Loss"):
|
if d.debit or d.credit or (self.voucher_type == "Exchange Gain Or Loss"):
|
||||||
r = [d.user_remark, self.remark]
|
remarks = self.remark
|
||||||
r = [x for x in r if x]
|
|
||||||
remarks = "\n".join(r)
|
|
||||||
|
|
||||||
row = {
|
row = {
|
||||||
"account": d.account,
|
"account": d.account,
|
||||||
@@ -1548,7 +1547,7 @@ def get_against_jv(doctype, txt, searchfield, start, page_len, filters):
|
|||||||
frappe.qb.from_(JournalEntry)
|
frappe.qb.from_(JournalEntry)
|
||||||
.join(JournalEntryAccount)
|
.join(JournalEntryAccount)
|
||||||
.on(JournalEntryAccount.parent == JournalEntry.name)
|
.on(JournalEntryAccount.parent == JournalEntry.name)
|
||||||
.select(JournalEntry.name, JournalEntry.posting_date, JournalEntry.user_remark)
|
.select(JournalEntry.name, JournalEntry.posting_date, JournalEntry.remark)
|
||||||
.where(JournalEntryAccount.account == filters.get("account"))
|
.where(JournalEntryAccount.account == filters.get("account"))
|
||||||
.where(JournalEntryAccount.reference_type.isnull() | (JournalEntryAccount.reference_type == ""))
|
.where(JournalEntryAccount.reference_type.isnull() | (JournalEntryAccount.reference_type == ""))
|
||||||
.where(JournalEntry.docstatus == 1)
|
.where(JournalEntry.docstatus == 1)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
frappe.listview_settings["Journal Entry"] = {
|
frappe.listview_settings["Journal Entry"] = {
|
||||||
add_fields: ["voucher_type", "posting_date", "total_debit", "company", "user_remark"],
|
add_fields: ["voucher_type", "posting_date", "total_debit", "company", "remark"],
|
||||||
get_indicator: function (doc) {
|
get_indicator: function (doc) {
|
||||||
if (doc.docstatus === 1) {
|
if (doc.docstatus === 1) {
|
||||||
return [__(doc.voucher_type), "blue", `voucher_type,=,${doc.voucher_type}`];
|
return [__(doc.voucher_type), "blue", `voucher_type,=,${doc.voucher_type}`];
|
||||||
|
|||||||
@@ -523,7 +523,7 @@ class TestJournalEntry(ERPNextTestSuite):
|
|||||||
jv = frappe.new_doc("Journal Entry")
|
jv = frappe.new_doc("Journal Entry")
|
||||||
jv.posting_date = nowdate()
|
jv.posting_date = nowdate()
|
||||||
jv.company = "_Test Company"
|
jv.company = "_Test Company"
|
||||||
jv.user_remark = "test"
|
jv.remark = "test"
|
||||||
jv.extend(
|
jv.extend(
|
||||||
"accounts",
|
"accounts",
|
||||||
[
|
[
|
||||||
@@ -592,6 +592,21 @@ class TestJournalEntry(ERPNextTestSuite):
|
|||||||
|
|
||||||
self.assertEqual(jv.pay_to_recd_from, "_Test Receiver 2")
|
self.assertEqual(jv.pay_to_recd_from, "_Test Receiver 2")
|
||||||
|
|
||||||
|
def test_custom_remark(self):
|
||||||
|
# When custom_remark is enabled, remark should not be auto-overwritten on save
|
||||||
|
jv = make_journal_entry("_Test Cash - _TC", "_Test Bank - _TC", 100, save=False)
|
||||||
|
jv.custom_remark = 1
|
||||||
|
jv.remark = "My custom remark text"
|
||||||
|
jv.insert()
|
||||||
|
self.assertEqual(jv.remark, "My custom remark text")
|
||||||
|
|
||||||
|
# When custom_remark is disabled, remark should be auto-generated
|
||||||
|
jv2 = make_journal_entry("_Test Cash - _TC", "_Test Bank - _TC", 100, save=False)
|
||||||
|
jv2.custom_remark = 0
|
||||||
|
jv2.remark = "Should be overwritten"
|
||||||
|
jv2.insert()
|
||||||
|
self.assertNotEqual(jv2.remark, "Should be overwritten")
|
||||||
|
|
||||||
def test_credit_limit_for_customer(self):
|
def test_credit_limit_for_customer(self):
|
||||||
customer = make_customer("_Test New Customer")
|
customer = make_customer("_Test New Customer")
|
||||||
set_credit_limit("_Test New Customer", "_Test Company", 50)
|
set_credit_limit("_Test New Customer", "_Test Company", 50)
|
||||||
@@ -620,7 +635,7 @@ def make_journal_entry(
|
|||||||
jv = frappe.new_doc("Journal Entry")
|
jv = frappe.new_doc("Journal Entry")
|
||||||
jv.posting_date = posting_date or nowdate()
|
jv.posting_date = posting_date or nowdate()
|
||||||
jv.company = company or "_Test Company"
|
jv.company = company or "_Test Company"
|
||||||
jv.user_remark = "test"
|
jv.remark = "test"
|
||||||
jv.multi_currency = 1
|
jv.multi_currency = 1
|
||||||
jv.set(
|
jv.set(
|
||||||
"accounts",
|
"accounts",
|
||||||
|
|||||||
Reference in New Issue
Block a user