mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-18 14:32:13 +00:00
fix: multiple fixes related to remarks for GL Report (#42753)
* fix: show remarks in report only if it exists
* fix: additional fixes to reduce redundancy in report print format
* fix: revert changes for supplier invoice reference
* fix: update remarks before submit to ensure all available details before submit are used
* fix: patch to update invoice remarks where it's not set
* fix: update remarks in payment ledger entry
(cherry picked from commit e5a49f738b)
This commit is contained in:
@@ -285,7 +285,6 @@ class PurchaseInvoice(BuyingController):
|
|||||||
self.set_against_expense_account()
|
self.set_against_expense_account()
|
||||||
self.validate_write_off_account()
|
self.validate_write_off_account()
|
||||||
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount")
|
self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount")
|
||||||
self.create_remarks()
|
|
||||||
self.set_status()
|
self.set_status()
|
||||||
self.validate_purchase_receipt_if_update_stock()
|
self.validate_purchase_receipt_if_update_stock()
|
||||||
validate_inter_company_party(
|
validate_inter_company_party(
|
||||||
@@ -322,10 +321,11 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
def create_remarks(self):
|
def create_remarks(self):
|
||||||
if not self.remarks:
|
if not self.remarks:
|
||||||
if self.bill_no and self.bill_date:
|
if self.bill_no:
|
||||||
self.remarks = _("Against Supplier Invoice {0} dated {1}").format(
|
self.remarks = _("Against Supplier Invoice {0}").format(self.bill_no)
|
||||||
self.bill_no, formatdate(self.bill_date)
|
if self.bill_date:
|
||||||
)
|
self.remarks += " " + _("dated {0}").format(formatdate(self.bill_date))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.remarks = _("No Remarks")
|
self.remarks = _("No Remarks")
|
||||||
|
|
||||||
@@ -747,6 +747,9 @@ class PurchaseInvoice(BuyingController):
|
|||||||
validate_docs_for_voucher_types(["Purchase Invoice"])
|
validate_docs_for_voucher_types(["Purchase Invoice"])
|
||||||
validate_docs_for_deferred_accounting([], [self.name])
|
validate_docs_for_deferred_accounting([], [self.name])
|
||||||
|
|
||||||
|
def before_submit(self):
|
||||||
|
self.create_remarks()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
super().on_submit()
|
super().on_submit()
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ class SalesInvoice(SellingController):
|
|||||||
self.check_sales_order_on_hold_or_close("sales_order")
|
self.check_sales_order_on_hold_or_close("sales_order")
|
||||||
self.validate_debit_to_acc()
|
self.validate_debit_to_acc()
|
||||||
self.clear_unallocated_advances("Sales Invoice Advance", "advances")
|
self.clear_unallocated_advances("Sales Invoice Advance", "advances")
|
||||||
self.add_remarks()
|
|
||||||
self.validate_fixed_asset()
|
self.validate_fixed_asset()
|
||||||
self.set_income_account_for_fixed_assets()
|
self.set_income_account_for_fixed_assets()
|
||||||
self.validate_item_cost_centers()
|
self.validate_item_cost_centers()
|
||||||
@@ -422,6 +421,9 @@ class SalesInvoice(SellingController):
|
|||||||
self.set_account_for_mode_of_payment()
|
self.set_account_for_mode_of_payment()
|
||||||
self.set_paid_amount()
|
self.set_paid_amount()
|
||||||
|
|
||||||
|
def before_submit(self):
|
||||||
|
self.add_remarks()
|
||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.validate_pos_paid_amount()
|
self.validate_pos_paid_amount()
|
||||||
|
|
||||||
@@ -946,10 +948,11 @@ class SalesInvoice(SellingController):
|
|||||||
|
|
||||||
def add_remarks(self):
|
def add_remarks(self):
|
||||||
if not self.remarks:
|
if not self.remarks:
|
||||||
if self.po_no and self.po_date:
|
if self.po_no:
|
||||||
self.remarks = _("Against Customer Order {0} dated {1}").format(
|
self.remarks = _("Against Customer Order {0}").format(self.po_no)
|
||||||
self.po_no, formatdate(self.po_date)
|
if self.po_date:
|
||||||
)
|
self.remarks += " " + _("dated {0}").format(formatdate(self.po_data))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.remarks = _("No Remarks")
|
self.remarks = _("No Remarks")
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,9 @@
|
|||||||
<br>
|
<br>
|
||||||
{% } %}
|
{% } %}
|
||||||
|
|
||||||
<br>{%= __("Remarks") %}: {%= data[i].remarks %}
|
{% if(data[i].remarks) { %}
|
||||||
{% if(data[i].bill_no) { %}
|
<br>{%= __("Remarks") %}: {%= data[i].remarks %}
|
||||||
|
{% } else if(data[i].bill_no) { %}
|
||||||
<br>{%= __("Supplier Invoice No") %}: {%= data[i].bill_no %}
|
<br>{%= __("Supplier Invoice No") %}: {%= data[i].bill_no %}
|
||||||
{% } %}
|
{% } %}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -371,6 +371,7 @@ erpnext.patches.v15_0.update_warehouse_field_in_asset_repair_consumed_item_docty
|
|||||||
erpnext.patches.v15_0.update_asset_repair_field_in_stock_entry
|
erpnext.patches.v15_0.update_asset_repair_field_in_stock_entry
|
||||||
erpnext.patches.v15_0.update_total_number_of_booked_depreciations
|
erpnext.patches.v15_0.update_total_number_of_booked_depreciations
|
||||||
erpnext.patches.v15_0.do_not_use_batchwise_valuation
|
erpnext.patches.v15_0.do_not_use_batchwise_valuation
|
||||||
|
erpnext.patches.v15_0.update_invoice_remarks
|
||||||
erpnext.patches.v14_0.update_reports_with_range
|
erpnext.patches.v14_0.update_reports_with_range
|
||||||
erpnext.patches.v15_0.drop_index_posting_datetime_from_sle
|
erpnext.patches.v15_0.drop_index_posting_datetime_from_sle
|
||||||
erpnext.patches.v15_0.add_disassembly_order_stock_entry_type #1
|
erpnext.patches.v15_0.add_disassembly_order_stock_entry_type #1
|
||||||
|
|||||||
51
erpnext/patches/v15_0/update_invoice_remarks.py
Normal file
51
erpnext/patches/v15_0/update_invoice_remarks.py
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import frappe
|
||||||
|
from frappe import _
|
||||||
|
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
update_sales_invoice_remarks()
|
||||||
|
update_purchase_invoice_remarks()
|
||||||
|
|
||||||
|
|
||||||
|
def update_sales_invoice_remarks():
|
||||||
|
si_list = frappe.db.get_all(
|
||||||
|
"Sales Invoice",
|
||||||
|
filters={
|
||||||
|
"docstatus": 1,
|
||||||
|
"remarks": "No Remarks",
|
||||||
|
"po_no": ["!=", ""],
|
||||||
|
},
|
||||||
|
fields=["name", "po_no"],
|
||||||
|
)
|
||||||
|
|
||||||
|
for doc in si_list:
|
||||||
|
remarks = _("Against Customer Order {0}").format(doc.po_no)
|
||||||
|
update_remarks("Sales Invoice", doc.name, remarks)
|
||||||
|
|
||||||
|
|
||||||
|
def update_purchase_invoice_remarks():
|
||||||
|
pi_list = frappe.db.get_all(
|
||||||
|
"Purchase Invoice",
|
||||||
|
filters={
|
||||||
|
"docstatus": 1,
|
||||||
|
"remarks": "No Remarks",
|
||||||
|
"bill_no": ["!=", ""],
|
||||||
|
},
|
||||||
|
fields=["name", "bill_no"],
|
||||||
|
)
|
||||||
|
|
||||||
|
for doc in pi_list:
|
||||||
|
remarks = _("Against Supplier Invoice {0}").format(doc.bill_no)
|
||||||
|
update_remarks("Purchase Invoice", doc.name, remarks)
|
||||||
|
|
||||||
|
|
||||||
|
def update_remarks(doctype, docname, remarks):
|
||||||
|
filters = {
|
||||||
|
"voucher_type": doctype,
|
||||||
|
"remarks": "No Remarks",
|
||||||
|
"voucher_no": docname,
|
||||||
|
}
|
||||||
|
|
||||||
|
frappe.db.set_value(doctype, docname, "remarks", remarks)
|
||||||
|
frappe.db.set_value("GL Entry", filters, "remarks", remarks)
|
||||||
|
frappe.db.set_value("Payment Ledger Entry", filters, "remarks", remarks)
|
||||||
Reference in New Issue
Block a user